Documentation
¶
Index ¶
- Variables
- func GenerateCode(cfg Config, database *Database) error
- func GenerateProto(cfg Config, database *Database) error
- func ReadFile(cfg *Config, configFile string)
- type Column
- type Config
- type Database
- type ForeignColumns
- type ForeignRelation
- type Index
- type IndexType
- type Provider
- type RelationType
- type Schema
- type Table
Constants ¶
This section is empty.
Variables ¶
View Source
var InvalidArguments = errors.New("invalid argument")
Functions ¶
func GenerateCode ¶
func GenerateProto ¶
Types ¶
type Column ¶
type Column struct {
TableName string
TableSchema string
ColumnName string
OrdinalPosition int
DataType string
UdtName string
ColumnDefault string
IsNullable bool
IsSequence bool
IsPrimaryKey bool
}
Column The structure of a column
type Config ¶
type Config struct {
Database struct {
Provider string `yaml:"provider"`
Host string `yaml:"host"`
Port string `yaml:"port"`
Database string `yaml:"database"`
Username string `yaml:"user"`
Password string `yaml:"password"`
} `yaml:"database"`
Output struct {
Path string `yaml:"path"`
Suffix string `yaml:"suffix"`
Lang string `yaml:"lang"`
} `yaml:"output"`
EmbedRelationships bool `yaml:"embed_relationships"`
Proto struct {
Path string `yaml:"path"`
JavaPackage string `yaml:"java_package"`
ObjCPrefix string `yaml:"objc_prefix"`
Version string `yaml:"version"`
} `yaml:"proto"`
Generator struct {
Schemas []string `yaml:"schemas"`
ExcludedTables []string `yaml:"excluded_tables"`
IndexedLookups bool `yaml:"indexed_lookups"`
ExcludedColumns []struct {
Tablename string `yaml:"table"`
Columns []string `yaml:"columns"`
} `yaml:"excluded_columns"`
Mapping []struct {
Tablename string `yaml:"table"`
Queries []struct {
Name string `yaml:"name"`
Query string `yaml:"query"`
} `yaml:"queries"`
} `yaml:"mapping"`
Transforms []struct {
Tablename string `yaml:"table"`
Xforms struct {
Select []struct {
Columnname string `yaml:"column"`
Datatype string `yaml:"data_type"`
Xform string `yaml:"xform"`
} `yaml:"select"`
Insert []struct {
Columnname string `yaml:"column"`
Datatype string `yaml:"data_type"`
Xform string `yaml:"xform"`
}
Update []struct {
Columnname string `yaml:"column"`
Datatype string `yaml:"data_type"`
Xform string `yaml:"xform"`
}
} `yaml:"xforms"`
} `yaml:"transforms"`
} `yaml:"generator"`
}
Config The expected YAML configuration for generating code based on a database schema
type ForeignColumns ¶
type ForeignRelation ¶
type ForeignRelation struct {
ForeignSchema string
ForeignTable string
MapName string
Columns []ForeignColumns
RelationType RelationType
}
type RelationType ¶
type RelationType int
const ( ZeroOneOrMore RelationType = 0 ManyToMany RelationType = 1 // These are not supported because of the implicit cycles )
Click to show internal directories.
Click to hide internal directories.