Documentation ¶
Index ¶
- Variables
- func ProcessSchema(dirPath string, schemaMetaData metadata.Schema, generatorTemplate Template) error
- type EnumModel
- type EnumSQLBuilder
- type Model
- func (m Model) PackageName() string
- func (m Model) UseEnum(enumFunc func(enumMetaData metadata.Enum) EnumModel) Model
- func (m Model) UsePath(path string) Model
- func (m Model) UseTable(tableModelFunc func(table metadata.Table) TableModel) Model
- func (m Model) UseView(tableModelFunc func(table metadata.Table) TableModel) Model
- type SQLBuilder
- func (sb SQLBuilder) UseEnum(enumFunc func(enum metadata.Enum) EnumSQLBuilder) SQLBuilder
- func (sb SQLBuilder) UsePath(path string) SQLBuilder
- func (sb SQLBuilder) UseTable(tableFunc func(table metadata.Table) TableSQLBuilder) SQLBuilder
- func (sb SQLBuilder) UseView(viewFunc func(table metadata.Table) ViewSQLBuilder) SQLBuilder
- type Schema
- type TableModel
- type TableModelField
- type TableSQLBuilder
- func (tb TableSQLBuilder) PackageName() string
- func (tb TableSQLBuilder) UseColumn(columnsFunc func(column metadata.Column) TableSQLBuilderColumn) TableSQLBuilder
- func (tb TableSQLBuilder) UseDefaultAlias(defaultAlias string) TableSQLBuilder
- func (tb TableSQLBuilder) UseFileName(name string) TableSQLBuilder
- func (tb TableSQLBuilder) UseInstanceName(name string) TableSQLBuilder
- func (tb TableSQLBuilder) UsePath(path string) TableSQLBuilder
- func (tb TableSQLBuilder) UseTypeName(name string) TableSQLBuilder
- type TableSQLBuilderColumn
- type Template
- type Type
- type ViewModel
- type ViewSQLBuilder
Constants ¶
This section is empty.
Variables ¶
var DefaultViewModel = DefaultTableModel
DefaultViewModel is default view template implementation
Functions ¶
Types ¶
type EnumModel ¶
type EnumModel struct { Skip bool FileName string TypeName string ValueName func(value string) string }
EnumModel is template for enum model files generation
func DefaultEnumModel ¶
DefaultEnumModel returns default implementation for EnumModel
func (EnumModel) UseFileName ¶
UseFileName returns new EnumModel with new file name set
func (EnumModel) UseTypeName ¶
UseTypeName returns new EnumModel with new type name set
type EnumSQLBuilder ¶
type EnumSQLBuilder struct { Skip bool Path string FileName string InstanceName string ValueName func(enumValue string) string }
EnumSQLBuilder is template for generating enum SQLBuilder files
func DefaultEnumSQLBuilder ¶
func DefaultEnumSQLBuilder(enumMetaData metadata.Enum) EnumSQLBuilder
DefaultEnumSQLBuilder returns default implementation of EnumSQLBuilder
func (EnumSQLBuilder) PackageName ¶
func (e EnumSQLBuilder) PackageName() string
PackageName returns enum sql builder package name
func (EnumSQLBuilder) UseFileName ¶
func (e EnumSQLBuilder) UseFileName(name string) EnumSQLBuilder
UseFileName returns new EnumSQLBuilder with new file name set
func (EnumSQLBuilder) UseInstanceName ¶
func (e EnumSQLBuilder) UseInstanceName(name string) EnumSQLBuilder
UseInstanceName returns new EnumSQLBuilder with instance name set
func (EnumSQLBuilder) UsePath ¶
func (e EnumSQLBuilder) UsePath(path string) EnumSQLBuilder
UsePath returns new EnumSQLBuilder with new path set
type Model ¶
type Model struct { Skip bool Path string Table func(table metadata.Table) TableModel View func(table metadata.Table) ViewModel Enum func(enum metadata.Enum) EnumModel }
Model is template for model files generation
func DefaultModel ¶
func DefaultModel() Model
DefaultModel returns default Model template implementation
func (Model) PackageName ¶
PackageName returns package name of model types
func (Model) UseEnum ¶
UseEnum returns new Model template with replaced template for enum model files generation
type SQLBuilder ¶
type SQLBuilder struct { Skip bool Path string Table func(table metadata.Table) TableSQLBuilder View func(view metadata.Table) TableSQLBuilder Enum func(enum metadata.Enum) EnumSQLBuilder }
SQLBuilder is template for generating sql builder files
func DefaultSQLBuilder ¶
func DefaultSQLBuilder() SQLBuilder
DefaultSQLBuilder returns default SQLBuilder implementation
func (SQLBuilder) UseEnum ¶
func (sb SQLBuilder) UseEnum(enumFunc func(enum metadata.Enum) EnumSQLBuilder) SQLBuilder
UseEnum returns new SQLBuilder with new EnumSQLBuilder template function set
func (SQLBuilder) UsePath ¶
func (sb SQLBuilder) UsePath(path string) SQLBuilder
UsePath returns new SQLBuilder with new relative path set
func (SQLBuilder) UseTable ¶
func (sb SQLBuilder) UseTable(tableFunc func(table metadata.Table) TableSQLBuilder) SQLBuilder
UseTable returns new SQLBuilder with new TableSQLBuilder template function set
func (SQLBuilder) UseView ¶
func (sb SQLBuilder) UseView(viewFunc func(table metadata.Table) ViewSQLBuilder) SQLBuilder
UseView returns new SQLBuilder with new ViewSQLBuilder template function set
type Schema ¶
type Schema struct { Path string Model Model SQLBuilder SQLBuilder }
Schema is schema generator template used to generate schema(model and sql builder) files
func DefaultSchema ¶
DefaultSchema returns default schema template implementation
func (Schema) UseModel ¶
UseModel returns new schema template with replaced template for model files generation
func (Schema) UseSQLBuilder ¶
func (s Schema) UseSQLBuilder(sqlBuilder SQLBuilder) Schema
UseSQLBuilder returns new schema with replaced template for sql builder files generation
type TableModel ¶
type TableModel struct { Skip bool FileName string TypeName string Field func(columnMetaData metadata.Column) TableModelField }
TableModel is template for table model files generation
func DefaultTableModel ¶
func DefaultTableModel(tableMetaData metadata.Table) TableModel
DefaultTableModel is default table template implementation
func (TableModel) UseField ¶
func (t TableModel) UseField(structFieldFunc func(columnMetaData metadata.Column) TableModelField) TableModel
UseField returns new TableModel with new TableModelField template function
func (TableModel) UseFileName ¶
func (t TableModel) UseFileName(fileName string) TableModel
UseFileName returns new TableModel with new file name set
func (TableModel) UseTypeName ¶
func (t TableModel) UseTypeName(typeName string) TableModel
UseTypeName returns new TableModel with new type name set
type TableModelField ¶
TableModelField is template for table model field generation
func DefaultTableModelField ¶
func DefaultTableModelField(columnMetaData metadata.Column) TableModelField
DefaultTableModelField returns default TableModelField implementation
func (TableModelField) TagsString ¶
func (f TableModelField) TagsString() string
TagsString returns tags string representation
func (TableModelField) UseName ¶
func (f TableModelField) UseName(name string) TableModelField
UseName returns new TableModelField implementation with new field name set
func (TableModelField) UseTags ¶
func (f TableModelField) UseTags(tags ...string) TableModelField
UseTags returns new TableModelField implementation with additional tags added.
func (TableModelField) UseType ¶
func (f TableModelField) UseType(t Type) TableModelField
UseType returns new TypeModelField with a new field type set
type TableSQLBuilder ¶
type TableSQLBuilder struct { Skip bool Path string FileName string InstanceName string TypeName string DefaultAlias string Column func(columnMetaData metadata.Column) TableSQLBuilderColumn }
TableSQLBuilder is template for generating table SQLBuilder files
func DefaultTableSQLBuilder ¶
func DefaultTableSQLBuilder(tableMetaData metadata.Table) TableSQLBuilder
DefaultTableSQLBuilder returns default implementation for TableSQLBuilder
func (TableSQLBuilder) PackageName ¶
func (tb TableSQLBuilder) PackageName() string
PackageName returns package name of table sql builder types
func (TableSQLBuilder) UseColumn ¶
func (tb TableSQLBuilder) UseColumn(columnsFunc func(column metadata.Column) TableSQLBuilderColumn) TableSQLBuilder
UseColumn returns new TableSQLBuilder with new column template function set
func (TableSQLBuilder) UseDefaultAlias ¶
func (tb TableSQLBuilder) UseDefaultAlias(defaultAlias string) TableSQLBuilder
UseDefaultAlias returns new TableSQLBuilder with new default alias set
func (TableSQLBuilder) UseFileName ¶
func (tb TableSQLBuilder) UseFileName(name string) TableSQLBuilder
UseFileName returns new TableSQLBuilder with new file name set
func (TableSQLBuilder) UseInstanceName ¶
func (tb TableSQLBuilder) UseInstanceName(name string) TableSQLBuilder
UseInstanceName returns new TableSQLBuilder with new instance name set
func (TableSQLBuilder) UsePath ¶
func (tb TableSQLBuilder) UsePath(path string) TableSQLBuilder
UsePath returns new TableSQLBuilder with new relative path set
func (TableSQLBuilder) UseTypeName ¶
func (tb TableSQLBuilder) UseTypeName(name string) TableSQLBuilder
UseTypeName returns new TableSQLBuilder with new type name set
type TableSQLBuilderColumn ¶
TableSQLBuilderColumn is template for table sql builder column
func DefaultTableSQLBuilderColumn ¶
func DefaultTableSQLBuilderColumn(columnMetaData metadata.Column) TableSQLBuilderColumn
DefaultTableSQLBuilderColumn returns default implementation of TableSQLBuilderColumn
type Template ¶
Template is generator template used for file generation
type ViewSQLBuilder ¶
type ViewSQLBuilder = TableSQLBuilder
ViewSQLBuilder is template for generating view SQLBuilder files
func DefaultViewSQLBuilder ¶
func DefaultViewSQLBuilder(viewMetaData metadata.Table) ViewSQLBuilder
DefaultViewSQLBuilder returns default implementation for ViewSQLBuilder