Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetTagName ¶
func SetTagName(tag string)
Set custom struct tag for database types. default is "sql"
Types ¶
type Field ¶
type Field struct { Name string ColumnName string DType string Nullable bool DefaultValue string Table *Table }
Represents a database field.
type ForeignKey ¶
Represents a foreign key
type Table ¶
type Table struct { Model any TableName string PrimaryKey string Fields []Field ForeignKeys []ForeignKey }
Represents
type TableMap ¶
func GenerateSchema ¶
Parse the models(structs) and generate sql statements to create the tables. Returns the table create statements and a list of table names. Schema is sorted(as best as possible) to avoid errors during migrations.
Click to show internal directories.
Click to hide internal directories.