schema

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: MIT Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalComment added in v0.7.0

type AdditionalComment struct {
	Table          string            `yaml:"table"`
	TableComment   string            `yaml:"tableComment"`
	ColumnComments map[string]string `yaml:"columnComments"`
}

AdditionalComment is the struct for table relation from yaml

type AdditionalData added in v0.4.0

type AdditionalData struct {
	Relations []AdditionalRelation `yaml:"relations"`
	Comments  []AdditionalComment  `yaml:"comments"`
}

AdditionalData is the struct for table relations from yaml

type AdditionalRelation added in v0.4.0

type AdditionalRelation struct {
	Table         string   `yaml:"table"`
	Columns       []string `yaml:"columns"`
	ParentTable   string   `yaml:"parentTable"`
	ParentColumns []string `yaml:"parentColumns"`
	Def           string   `yaml:"def"`
}

AdditionalRelation is the struct for table relation from yaml

type Column

type Column struct {
	Name            string
	Type            string
	Nullable        bool
	Default         sql.NullString
	Comment         string
	ParentRelations []*Relation
	ChildRelations  []*Relation
}

Column is the struct for table column

type Constraint added in v0.2.2

type Constraint struct {
	Name string
	Type string
	Def  string
}

Constraint is the struct for database constraint

type Index

type Index struct {
	Name string
	Def  string
}

Index is the struct for database index

type Relation

type Relation struct {
	Table         *Table
	Columns       []*Column
	ParentTable   *Table
	ParentColumns []*Column
	Def           string
	IsAdditional  bool
}

Relation is the struct for table relation

type Schema

type Schema struct {
	Name      string
	Tables    []*Table
	Relations []*Relation
}

Schema is the struct for database schema

func (*Schema) AddAdditionalData added in v0.7.0

func (s *Schema) AddAdditionalData(buf []byte) error

AddAdditionalData add additional data (relations, comments) from yaml buffer

func (*Schema) FindTableByName

func (s *Schema) FindTableByName(name string) (*Table, error)

FindTableByName find table by table name

func (*Schema) LoadAdditionalData added in v0.7.0

func (s *Schema) LoadAdditionalData(path string) error

LoadAdditionalData load additional data (relations, comments) from yaml file

func (*Schema) Sort added in v0.2.0

func (s *Schema) Sort() error

Sort schema tables, columns, relations, and constrains

type Table

type Table struct {
	Name        string
	Type        string
	Comment     string
	Columns     []*Column
	Indexes     []*Index
	Constraints []*Constraint
	Def         string
}

Table is the struct for database table

func (*Table) FindColumnByName

func (t *Table) FindColumnByName(name string) (*Column, error)

FindColumnByName find column by column name

Jump to

Keyboard shortcuts

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