schema

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 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 AdditionalData added in v0.4.0

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

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) FindTableByName

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

FindTableByName find table by table name

func (*Schema) LoadAdditionalRelations added in v0.4.0

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

LoadAdditionalRelations load additional relations 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
}

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