Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct { Name string GoName string Datatype datatype.Datatype Unsigned bool Nullable bool Default *string Params []string Charset string Collation string PrimaryKey bool AutoIncrement bool }
Column represents a column in a table
func (*Column) ExportedGoName ¶
ExportedGoName returns the string that will be used for naming Exported types, functions, etc in generated Go code
func (*Column) GoTypeString ¶
GoTypeString returns the string keyword of the column type's corresponding Go type
func (*Column) RequiredImport ¶
RequiredImport returns any packages that need to be imported to support the Go type of a column in generated Go code
func (*Column) UnmarshalYAML ¶
type Database ¶
Database represents a single database/schema in a DBMS.
func (*Database) GetTable ¶
GetTable returns a table matching the given name if present. If a matching table is found, the returned bool is true. If a matching table is not found, the returned bool is false.
func (*Database) UnmarshalYAML ¶
type Reference ¶
type Reference struct { GoName string TableName string HasOne bool HasMany bool Required bool ColumnNames []string OnDelete string OnUpdate string }
Reference represents a relationship between tables. Not a SQL-native concept, more of an ORM-style design. Translates to foreign keys and constraints in SQL
func (*Reference) ColNames ¶
ColNames returns a list foreign key column names for the given reference. The method assumes that the `fTable` value is correct (for example, the "many" side in a one-to-many reference) and not necessarily the target table of the Reference itself. So make sure the Yoyo-to-RDB reference translation has already happened before calling ColNames.
func (*Reference) ExportedGoName ¶ added in v0.0.5
ExportedGoName returns the string that will be used for naming Exported types, functions, etc in generated Go code
func (*Reference) UnmarshalYAML ¶
type Table ¶
type Table struct { Name string GoName string Columns []Column Indices []Index References []Reference }
Table represents a table in a database
func (*Table) ExportedGoName ¶
ExportedGoName returns a string with a name to use to represent the table in Exported go types or variables. If a GoName is explicitly set already, the returned value will be that forced into PascalCase. If not, it will be the default name forced into PascalCase.
func (*Table) GetColumn ¶
GetColumn returns a column matching the given name if present. If a matching column is found, the returned bool is true. If a matching column is not found, the returned bool is false.
func (*Table) PKColNames ¶
PKColNames returns a list of column names that represent this table's Primary Key. This is usually a slice with a single value, but may be empty if there is no PK, and may be several if it's a compound PK
func (*Table) PKColumns ¶
PKColumns returns a list of Columns that represent this table's Primary Key. This is usually a slice with a single value, but may be empty if there is no PK, and may be several if it's a compound PK
func (*Table) QueryPackageName ¶
QueryPackageName returns a string to use for this table's query package