reader

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUpSchema

func IsUpSchema(r *Record) bool

Types

type Column

type Column struct {
	Name       string  `yaml:"name" json:"name"`
	Type       string  `yaml:"type" json:"type"`
	Default    *string `yaml:"default" json:"default"`
	Null       *bool   `yaml:"null" json:"null"`
	PrimaryKey *bool   `yaml:"primary_key" json:"primary_key"`
}

type Index

type Index struct {
	Name   string `yaml:"name" json:"name"`
	Column string `yaml:"column" json:"column"`
	Def    string `yaml:"def" json:"def"`
	Unique *bool  `yaml:"unique" json:"unique"`
	Pkey   *bool  `yaml:"is_pkey" json:"is_pkey"`
}

type Record

type Record struct {
	Version       string
	Cache         string
	Kind          string
	RollbackQuery *string
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (*Record) Delete

func (r *Record) Delete(ctx context.Context, db *db.DB) error

func (Record) Save

func (r Record) Save(ctx context.Context, db *db.DB) error

type Schema

type Schema struct {
	Tables []Table `yaml:"tables" json:"tables"`
}

type SchemaReader

type SchemaReader struct {
	// contains filtered or unexported fields
}

func New

func New(conn *db.DB) *SchemaReader

func (*SchemaReader) JSON

func (r *SchemaReader) JSON() ([]byte, error)

func (*SchemaReader) Read

func (r *SchemaReader) Read(ctx context.Context) error

func (*SchemaReader) Save

func (r *SchemaReader) Save(ctx context.Context, re *Record) error

func (*SchemaReader) Schema

func (r *SchemaReader) Schema(ctx context.Context) (*Schema, error)

func (*SchemaReader) Version

func (r *SchemaReader) Version() (string, error)

func (*SchemaReader) Yaml

func (r *SchemaReader) Yaml() ([]byte, error)

type Table

type Table struct {
	Name    string   `yaml:"name" json:"name"`
	Columns []Column `yaml:"columns" json:"columns"`
	Indexes []Index  `yaml:"indexes" json:"indexes"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL