Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnMetaData ¶
type ColumnMetaData struct { Name string IsNullable bool DataType string EnumName string IsUnsigned bool SqlBuilderColumnType string GoBaseType string GoModelType string }
ColumnMetaData struct
func NewColumnMetaData ¶
func NewColumnMetaData(name string, isNullable bool, dataType string, enumName string, isUnsigned bool) ColumnMetaData
NewColumnMetaData create new column meta data that describes one column in SQL database
func (ColumnMetaData) GoModelTag ¶
func (c ColumnMetaData) GoModelTag(isPrimaryKey bool) string
GoModelTag returns model field tag for column
type DialectQuerySet ¶
type DialectQuerySet interface { ListOfTablesQuery() string PrimaryKeysQuery() string ListOfColumnsQuery() string ListOfEnumsQuery() string GetEnumsMetaData(db *sql.DB, schemaName string) []MetaData }
DialectQuerySet is set of methods necessary to retrieve dialect meta data information
type EnumMetaData ¶
EnumMetaData struct
type SchemaMetaData ¶
type SchemaMetaData struct { TablesMetaData []MetaData ViewsMetaData []MetaData EnumsMetaData []MetaData }
SchemaMetaData struct
func GetSchemaMetaData ¶
func GetSchemaMetaData(db *sql.DB, schemaName string, querySet DialectQuerySet) (schemaInfo SchemaMetaData)
GetSchemaMetaData returns schema information from db connection.
func (SchemaMetaData) IsEmpty ¶
func (s SchemaMetaData) IsEmpty() bool
IsEmpty returns true if schema info does not contain any table, views or enums metadata
type TableMetaData ¶
type TableMetaData struct { SchemaName string PrimaryKeys map[string]bool Columns []ColumnMetaData // contains filtered or unexported fields }
TableMetaData metadata struct
func GetTableMetaData ¶
func GetTableMetaData(db *sql.DB, querySet DialectQuerySet, schemaName, tableName string) (tableInfo TableMetaData)
GetTableMetaData returns table info metadata
func (TableMetaData) GetImports ¶
func (t TableMetaData) GetImports() []string
GetImports returns model imports for table.
func (TableMetaData) GoStructImplName ¶
func (t TableMetaData) GoStructImplName() string
GoStructImplName returns go struct impl name for sql builder
func (TableMetaData) GoStructName ¶
func (t TableMetaData) GoStructName() string
GoStructName returns go struct name for sql builder
func (TableMetaData) IsPrimaryKey ¶
func (t TableMetaData) IsPrimaryKey(column string) bool
IsPrimaryKey returns if column is a part of primary key
func (TableMetaData) MutableColumns ¶
func (t TableMetaData) MutableColumns() []ColumnMetaData
MutableColumns returns list of mutable columns for table