Documentation
¶
Index ¶
- Variables
- type Config
- type DatabaseConfig
- type DbGenerator
- func (dbg *DbGenerator) BuildDatabase(sqlfiles []string) error
- func (dbg *DbGenerator) ClearDdlDirectory() error
- func (dbg *DbGenerator) ComposeTableFromJson(filepath string) (tbl *Table, err error)
- func (dbg *DbGenerator) GenerateAll() ([]string, error)
- func (dbg *DbGenerator) ReadConfiguration(configfilepath string)
- type DirectoryConfig
- type Field
- type Relation
- type Table
- type TableRelations
Constants ¶
This section is empty.
Variables ¶
View Source
var ColorBlue = "\033[34m"
View Source
var ColorCyan = "\033[36m"
View Source
var ColorGray = "\033[37m"
View Source
var ColorGreen = "\033[32m"
View Source
var ColorMagenta = "\033[35m"
View Source
var ColorRed = "\033[31m"
View Source
var ColorReset = "\033[0m"
View Source
var ColorWhite = "\033[97m"
View Source
var ColorYellow = "\033[33m"
View Source
var FieldProp []string = []string{"name", "descr", "type", "length", "precision", "nullable", "default"}
View Source
var RelationProp []string = []string{"key", "name", "table", "field"}
View Source
var TableProp []string = []string{"schema", "table", "descr", "fields", "primarykeys", "uniques", "relations"}
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Database *DatabaseConfig `yml:"database"`
Directories *DirectoryConfig `yml:"directories"`
}
type DatabaseConfig ¶
type DbGenerator ¶
type DbGenerator struct {
Config *Config
}
func NewGenerator ¶
func NewGenerator() *DbGenerator
func (*DbGenerator) BuildDatabase ¶
func (dbg *DbGenerator) BuildDatabase(sqlfiles []string) error
func (*DbGenerator) ClearDdlDirectory ¶
func (dbg *DbGenerator) ClearDdlDirectory() error
func (*DbGenerator) ComposeTableFromJson ¶
func (dbg *DbGenerator) ComposeTableFromJson(filepath string) (tbl *Table, err error)
func (*DbGenerator) GenerateAll ¶
func (dbg *DbGenerator) GenerateAll() ([]string, error)
func (*DbGenerator) ReadConfiguration ¶
func (dbg *DbGenerator) ReadConfiguration(configfilepath string)
type DirectoryConfig ¶
type Field ¶
type Field struct {
Name string `json:"name"`
Description string `json:"descr"`
DataType string `json:"type"`
Length int `json:"length"`
Precision int `json:"precision"`
Nullable bool `json:"nullable"`
DefaultValue string `json:"default"`
IsPrimaryKey bool
}
func (*Field) AddFieldDdl ¶
func (*Field) AlterFieldDdl ¶
func (*Field) CreateFieldDdl ¶
type Table ¶
type Table struct {
Schema string `json:"schema"`
TableName string `json:"table"`
Description string `json:"descr"`
Fields map[string]*Field `json:"fields"`
PrimaryKeys []string `json:"primarykeys"`
Uniques map[string]*[]string `json:"uniques"`
Relations map[string]Relation `json:"relations"`
FieldNames []string
PropNames []string
}
func (*Table) AddMandatoryFields ¶
func (*Table) GetRelations ¶
type TableRelations ¶
type TableRelations struct {
Relations []*Relation
}
func NewTableRelations ¶
func NewTableRelations() *TableRelations
func (*TableRelations) Add ¶
func (t *TableRelations) Add(r []*Relation)
func (*TableRelations) WriteSql ¶
func (t *TableRelations) WriteSql(sqlfilepath string) error
Click to show internal directories.
Click to hide internal directories.