erdh

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetThatCardinality

func GetThatCardinality(that string) string

func GetThisCardinality

func GetThisCardinality(this string) string

func WritePuml

func WritePuml(w io.Writer, cons *Construction, conf *config.Config) error

Types

type Column

type Column struct {
	Name       string `yaml:"name"`
	ColumnType string `yaml:"type"`
	Key        string `yaml:"key"`
	Extra      string `yaml:"extra"`
	Default    string `yaml:"default"`
	NotNull    bool   `yaml:"not_null"`
	IsPrimary  bool   `yaml:"is_primary"`
}

type Construction

type Construction struct {
	DBName string  `yaml:"db_name"`
	Tables []Table `yaml:"tables"`
}

Construction 中間形式

func NewConstructionFromYaml

func NewConstructionFromYaml(buf []byte) (*Construction, error)

func NewConstructionFromYamlFile

func NewConstructionFromYamlFile(path string) (*Construction, error)

func (*Construction) ApplyExInfo

func (c *Construction) ApplyExInfo(exInfo config.ExtraConfig)

ApplyExInfo は config.ExtraConfig を ExRelations に適用する

func (Construction) GetGroupToTablesMap

func (c Construction) GetGroupToTablesMap() map[string][]string

GetGroupToTablesMap はグループからテーブルリストを得るためのマップを返す

func (*Construction) GetTableMut

func (c *Construction) GetTableMut(tblName string) *Table

GetTableMut は指定したテーブル名のTableへのポインタを返す

func (Construction) GetTableToGroupMap

func (c Construction) GetTableToGroupMap() map[string]string

GetTableToGroupMap はテーブルからグループを得るためのマップを返す

func (*Construction) UpdateExRelationsFromForeignKeys

func (c *Construction) UpdateExRelationsFromForeignKeys()

UpdateExRelationsFromForeignKeys は ForeginKeys を元にして ExRelations を更新する

type ExRelation

type ExRelation struct {
	ReferencedTableName string             `yaml:"referenced_table_name"`
	Columns             []ExRelationColumn `yaml:"columns"`
	ThisConn            string             `yaml:"this_conn"`
	ThatConn            string             `yaml:"that_conn"`
}

type ExRelationColumn

type ExRelationColumn struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

type ForeginKey

type ForeginKey struct {
	ConstraintName       string `yaml:"constraint_name"`
	ColumnName           string `yaml:"column_name"`
	ReferencedTableName  string `yaml:"referenced_table_name"`
	ReferencedColumnName string `yaml:"referenced_column_name"`
}

type Index

type Index struct {
	Name       string `yaml:"name"`
	ColumnName string `yaml:"column_name"`
}

type Table

type Table struct {
	Name        string       `yaml:"table"`
	Group       string       `yaml:"group"`
	Columns     []Column     `yaml:"columns"`
	Indexes     []Index      `yaml:"indexes"`
	ForeginKeys []ForeginKey `yaml:"foreign_keys"`
	ExRelations []ExRelation `yaml:"ex-relations"`
	IsMaster    bool         `yaml:"is-master"`
}

Table は中間形式中のテーブル型

func (*Table) AddColumn

func (t *Table) AddColumn(name, columnType, key, extra, def string, notnull, isPrimary bool)

func (*Table) AddExRelations

func (t *Table) AddExRelations(referencedTableName string, columns []ExRelationColumn, thisConn, thatConn string)

func (*Table) AddForeginKey

func (t *Table) AddForeginKey(constraintName, columnName, referencedTableName, ReferencedColumnName string)

func (*Table) AddIndex

func (t *Table) AddIndex(indexName, columnName string)

func (*Table) GetExRelationOfReferencedTableMut

func (t *Table) GetExRelationOfReferencedTableMut(tableName string) *ExRelation

Jump to

Keyboard shortcuts

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