Documentation
¶
Index ¶
- Variables
- func CheckError(err error)
- func CloseDB()
- func ConnectDB(userName, password, dbname string)
- func ConnectMsSqlServerDB(user, password, database string, port string)
- func ConnectOracleDB(user, password, server, service string, port int)
- func ConnectPostgresDB(user, password, dbname, host string, port int)
- func GetCSharpDataTypeForMySql(dataType string, numericPrecision int) string
- func GetCSharpDataTypeForOracle(dataType string, numericPrecision int) string
- func GetCSharpDataTypeForPostgres(dataType string, numericPrecision int) string
- func GetCSharpFirstUnitTestValueForMySql(dataType string) string
- func GetCSharpFirstUnitTestValueForOracle(dataType string) string
- func GetCSharpFirstUnitTestValueForPostgres(dataType string) string
- func GetCSharpSecondUnitTestValueForMySql(dataType string) string
- func GetCSharpSecondUnitTestValueForOracle(dataType string) string
- func GetCSharpSecondUnitTestValueForPostgres(dataType string) string
- func GetColumnNames(schema, tableName string) []string
- func GetGoDataTypeForMySql(dataType string, numericPrecision int) string
- func GetGoDataTypeForOracle(dataType string) string
- func GetGoDataTypeForPostgres(dataType string) string
- func GetGoFirstUnitTestValueForMySql(dataType string, numericPrecision int) string
- func GetGoFirstUnitTestValueForOracle(dataType string) string
- func GetGoFirstUnitTestValueForPostgres(dataType string) string
- func GetGoSecondUnitTestValueForMySql(dataType string, numericPrecision int) string
- func GetGoSecondUnitTestValueForOracle(dataType string) string
- func GetGoSecondUnitTestValueForPostgres(dataType string) string
- func GetJavaDataTypeForMySql(dataType string, numericPrecision int) string
- func GetJavaDataTypeForOracle(dataType string, numericPrecision int) string
- func GetJavaDataTypeForPostgres(dataType string, numericPrecision int) string
- func GetJavaFirstUnitTestValueForMySql(dataType string) string
- func GetJavaFirstUnitTestValueForOracle(dataType string) string
- func GetJavaFirstUnitTestValueForPostgres(dataType string) string
- func GetJavaSecondUnitTestValueForMySql(dataType string) string
- func GetJavaSecondUnitTestValueForOracle(dataType string) string
- func GetJavaSecondUnitTestValueForPostgres(dataType string) string
- func GetJavascriptDataTypeForMySql(dataType string, numericPrecision int) string
- func GetJavascriptDataTypeForOracle(dataType string, numericPrecision int) string
- func GetJavascriptDataTypeForPostgres(dataType string, numericPrecision int) string
- func GetJavascriptDefaultValueForMySql(dataType string, numericPrecision int) string
- func GetJavascriptDefaultValueForOracle(dataType string, numericPrecision int) string
- func GetJavascriptDefaultValueForPostgres(dataType string, numericPrecision int) string
- func GetMssqlIdentityColumns(tableName string) []string
- func GetMssqlPrimaryKeys(tableName, schema string) []string
- func GetPkColumnName(columnName string, keys []ForeignKey) string
- func GetPkTableName(columnName string, keys []ForeignKey) string
- func GetPostgresPrimaryKeys(tableName, schema string) []string
- func GetTableNames(schema string) []string
- func GetTableNamesMssql(database string, schema string) []string
- func GetTableNamesOracle() []string
- func GetTableNamesPostgres(schema string) []string
- func IsColumnForeignKey(columnName string, keys []ForeignKey) bool
- func MakeTitle(s string) string
- type Actor
- type Column
- func GetColumn(schema, columnName, tableName string) Column
- func GetColumnMssql(columnName, tableName string, primaryKeys []string, identityColumns []string) Column
- func GetColumnPostgres(schema, columnName, tableName, database string, primaryKeys []string) Column
- func GetColumnsOracle(tableName, schema string, primaryKeys []OraclePrimaryKey, fks []ForeignKey) []Column
- func GetMssqlColumns(tableName, schema, database string, fks []ForeignKey) []Column
- func GetPostgresColumns(tableName, schema, database string, fks []ForeignKey) []Column
- func NewColumn(columnName, databaseType, tableName string) Column
- func (c *Column) GetAspNetRouteConstraintType() string
- func (c *Column) GetCSharpDataType() string
- func (c *Column) GetCSharpFirstUnitTestValue() string
- func (c *Column) GetCSharpFirstUnitTestValueFromFile(valuesFile string) string
- func (c *Column) GetCSharpSecondUnitTestValue() string
- func (c *Column) GetCSharpSecondUnitTestValueFromFile(valuesFile string) string
- func (c *Column) GetCamelCaseColumnName() string
- func (c *Column) GetColumnNameInCase(caseToReturn string) string
- func (c *Column) GetColumnTableNameInCase(caseToReturn string) string
- func (c *Column) GetGoDataType() string
- func (c *Column) GetGoFirstUnitTestValue() string
- func (c *Column) GetGoSecondUnitTestValue() string
- func (c *Column) GetJavaDataType() string
- func (c *Column) GetJavaFirstUnitTestValue() string
- func (c *Column) GetJavaFirstUnitTestValueAsString() string
- func (c *Column) GetJavaFirstUnitTestValueFromFile(valuesFile string) string
- func (c *Column) GetJavaSecondUnitTestValue() string
- func (c *Column) GetJavaSecondUnitTestValueAsString() string
- func (c *Column) GetJavaSecondUnitTestValueFromFile(valuesFile string) string
- func (c *Column) GetJavascriptDataType() string
- func (c *Column) GetJavascriptDefaultValue() string
- func (c *Column) GetPascalCaseColumnName() string
- func (c *Column) GetPascalCaseTableName() string
- func (c *Column) GetSetString() string
- func (c *Column) GetSetStringJson() string
- func (c *Column) GetTitleCaseColumnName() string
- func (c *Column) GetTitleCaseTableName() string
- func (c *Column) IsBinary() bool
- func (c *Column) IsGoIntFamilyType() bool
- func (c *Column) Test() string
- type ForeignKey
- func GetForeignKeys(database, tableName string) []ForeignKey
- func GetMssqlForeignKeys(tableName string, primaryKeys []string, identityColumns []string) []ForeignKey
- func GetMssqlReferencedForeignKeys(tableName string, primaryKeys []string, identityColumns []string) []ForeignKey
- func GetOracleForeignKeys(tableName, schema string) []ForeignKey
- func GetOracleReferencedForeignKeys(tableName, schema string) []ForeignKey
- func GetPostgresForeignKeys(schema, database, tableName string, primaryKeys []string) []ForeignKey
- func GetPostgresReferencedForeignKeys(schema, database, tableName string, primaryKeys []string) []ForeignKey
- func GetReferencedForeignKeys(database, tableName string) []ForeignKey
- func NewForeignKey(constraintName, fkTableName, fkColumnName, pkTableName, pkColumnName string) ForeignKey
- func (f *ForeignKey) GetCamelCaseFKColumnName() string
- func (f *ForeignKey) GetCamelCaseFKTableName() string
- func (f *ForeignKey) GetCamelCaseFKTableNamePlural() string
- func (f *ForeignKey) GetCamelCasePKColumnName() string
- func (f *ForeignKey) GetCamelCasePKTableName() string
- func (f *ForeignKey) GetCamelCasePKTableNamePlural() string
- func (f *ForeignKey) GetFKTableNamePluralInCase() string
- func (f *ForeignKey) GetFkColumnNameInCase(caseToReturn string) string
- func (f *ForeignKey) GetFkTableNameInCase(caseToReturn string) string
- func (f *ForeignKey) GetPascalCaseFKColumnName() string
- func (f *ForeignKey) GetPascalCaseFKTableName() string
- func (f *ForeignKey) GetPascalCaseFKTableNamePlural(caseToReturn string) string
- func (f *ForeignKey) GetPascalCasePKColumnName() string
- func (f *ForeignKey) GetPascalCasePKTableName() string
- func (f *ForeignKey) GetPascalCasePKTableNamePlural() string
- func (f *ForeignKey) GetPkColumnNameInCase(caseToReturn string) string
- type GuiEdit
- type GuiList
- type GuiListColumn
- type GuiListTable
- type GuiListTables
- type IntegrationTestSettings
- type MySqlColumn
- type MySqlForeignKey
- type OracleColumn
- type OraclePrimaryKey
- type OrmColumn
- type OrmModel
- func (m *OrmModel) GetModelNameInCase(caseToReturn string) string
- func (m *OrmModel) GetModelNamePluralInCase(caseToReturn string) string
- func (m *OrmModel) GetModelTableNameInCase(caseToReturn string) string
- func (m *OrmModel) GetPrimaryModelColumns() []OrmColumn
- func (m *OrmModel) HasCompositePrimaryKey() bool
- type PostgresColumn
- type PostgresPrimaryKey
- type Table
- func (t *Table) AddColumn(column Column)
- func (t *Table) GetCSharpFirstPrimaryUnitTestValue() string
- func (t *Table) GetCSharpSecondPrimaryUnitTestValue() string
- func (t *Table) GetCamelCaseTableName() string
- func (t *Table) GetCamelCaseTableNameEF() string
- func (t *Table) GetCamelCaseTableNamePlural() string
- func (t *Table) GetColumnListWithCSharpTypes() string
- func (t *Table) GetFirstPrimaryColumn() Column
- func (t *Table) GetFirstPrimaryColumnCamelCaseColumnName() string
- func (t *Table) GetFirstPrimaryColumnJavaDataType() string
- func (t *Table) GetFirstPrimaryColumnJavaFirstUnitTestValue() string
- func (t *Table) GetFirstPrimaryColumnJavaSecondUnitTestValue() string
- func (t *Table) GetFirstPrimaryColumnPascalCaseColumnName() string
- func (t *Table) GetFirstPrimaryColumnSetString() string
- func (t *Table) GetFirstPrimarySetString() string
- func (t *Table) GetFkTableNameForColumn(columnName string) string
- func (t *Table) GetJavaFirstPrimaryUnitTestValue() string
- func (t *Table) GetJavaFirstPrimaryUnitTestValueAsString() string
- func (t *Table) GetJavaSecondPrimaryUnitTestValue() string
- func (t *Table) GetJavaSecondPrimaryUnitTestValueAsString() string
- func (t *Table) GetNullableColumns() []Column
- func (t *Table) GetPascalCaseTableName() string
- func (t *Table) GetPascalCaseTableNameEF() string
- func (t *Table) GetPascalCaseTableNamePlural() string
- func (t *Table) GetPrimaryColumnJavaTypesAndVariables() string
- func (t *Table) GetPrimaryColumnVariables() string
- func (t *Table) GetPrimaryColumns() []Column
- func (t *Table) GetPrimaryNonDateColumns() []Column
- func (t *Table) GetTableName() string
- func (t *Table) GetTableNameInCase(caseToReturn string) string
- func (t *Table) HasAnyDateColumn() bool
- func (t *Table) HasAutoIncrementColumn() bool
- func (t *Table) HasCompositePrimaryKey() bool
- func (t *Table) HasDateColumn() bool
- func (t *Table) HasDateTimeColumn() bool
- func (t *Table) HasJavaTypeColumn(javaType string) bool
- func (t *Table) HasJavascriptNumberColumn() bool
- func (t *Table) HasJavascriptStringColumn() bool
- func (t *Table) HasTimestampColumn() bool
- func (t *Table) HasYearColumn() bool
- type Tag
- type Template
- type Templates
- type UnitTestValue
- type UnitTestValueColumn
- type UnitTestValueTable
- type UnitTestValueTables
Constants ¶
This section is empty.
Variables ¶
var DB *sql.DB
Functions ¶
func CheckError ¶
func CheckError(err error)
func ConnectMsSqlServerDB ¶ added in v0.0.21
func ConnectOracleDB ¶
func ConnectPostgresDB ¶
func GetColumnNames ¶
func GetGoDataTypeForMySql ¶
func GetGoDataTypeForOracle ¶
func GetJavaDataTypeForMySql ¶
func GetMssqlIdentityColumns ¶ added in v0.0.21
func GetMssqlPrimaryKeys ¶ added in v0.0.21
func GetPkColumnName ¶
func GetPkColumnName(columnName string, keys []ForeignKey) string
func GetPkTableName ¶
func GetPkTableName(columnName string, keys []ForeignKey) string
func GetPostgresPrimaryKeys ¶
func GetTableNames ¶
func GetTableNamesMssql ¶ added in v0.0.21
func GetTableNamesOracle ¶
func GetTableNamesOracle() []string
func GetTableNamesPostgres ¶
func IsColumnForeignKey ¶
func IsColumnForeignKey(columnName string, keys []ForeignKey) bool
Types ¶
type Column ¶
type Column struct {
ColumnName, DataType, DatabaseType, TableName, PkTableName, PkColumnName string
IsPrimaryKey, IsNullable, IsAutoIncrement, IsForeignKey bool
OrdinalPosition, NumericPrecision, NumericScale, CharacterMaximumLength int
}
func GetColumnMssql ¶ added in v0.0.21
func GetColumnPostgres ¶
func GetColumnsOracle ¶
func GetColumnsOracle(tableName, schema string, primaryKeys []OraclePrimaryKey, fks []ForeignKey) []Column
func GetMssqlColumns ¶ added in v0.0.21
func GetMssqlColumns(tableName, schema, database string, fks []ForeignKey) []Column
func GetPostgresColumns ¶
func GetPostgresColumns(tableName, schema, database string, fks []ForeignKey) []Column
func (*Column) GetAspNetRouteConstraintType ¶
func (*Column) GetCSharpDataType ¶
func (*Column) GetCSharpFirstUnitTestValue ¶
func (*Column) GetCSharpFirstUnitTestValueFromFile ¶
func (*Column) GetCSharpSecondUnitTestValue ¶
func (*Column) GetCSharpSecondUnitTestValueFromFile ¶
func (*Column) GetCamelCaseColumnName ¶
func (*Column) GetColumnNameInCase ¶ added in v0.0.301
func (*Column) GetColumnTableNameInCase ¶ added in v0.0.301
func (*Column) GetGoDataType ¶
func (*Column) GetGoFirstUnitTestValue ¶
func (*Column) GetGoSecondUnitTestValue ¶
func (*Column) GetJavaDataType ¶
func (*Column) GetJavaFirstUnitTestValue ¶
func (*Column) GetJavaFirstUnitTestValueAsString ¶ added in v0.0.19
func (*Column) GetJavaFirstUnitTestValueFromFile ¶
func (*Column) GetJavaSecondUnitTestValue ¶
func (*Column) GetJavaSecondUnitTestValueAsString ¶ added in v0.0.19
func (*Column) GetJavaSecondUnitTestValueFromFile ¶
func (*Column) GetJavascriptDataType ¶
func (*Column) GetJavascriptDefaultValue ¶
func (*Column) GetPascalCaseColumnName ¶
func (*Column) GetPascalCaseTableName ¶
func (*Column) GetSetString ¶
func (*Column) GetSetStringJson ¶
func (*Column) GetTitleCaseColumnName ¶ added in v0.0.12
func (*Column) GetTitleCaseTableName ¶ added in v0.0.12
func (*Column) IsGoIntFamilyType ¶ added in v0.0.9
type ForeignKey ¶
type ForeignKey struct {
ConstraintName, FkTableName, FkColumnName, PkTableName, PkColumnName, Relation string
FkColumn, PkColumn Column
}
func GetForeignKeys ¶
func GetForeignKeys(database, tableName string) []ForeignKey
func GetMssqlForeignKeys ¶ added in v0.0.21
func GetMssqlForeignKeys(tableName string, primaryKeys []string, identityColumns []string) []ForeignKey
func GetMssqlReferencedForeignKeys ¶ added in v0.0.21
func GetMssqlReferencedForeignKeys(tableName string, primaryKeys []string, identityColumns []string) []ForeignKey
func GetOracleForeignKeys ¶
func GetOracleForeignKeys(tableName, schema string) []ForeignKey
func GetOracleReferencedForeignKeys ¶
func GetOracleReferencedForeignKeys(tableName, schema string) []ForeignKey
func GetPostgresForeignKeys ¶
func GetPostgresForeignKeys(schema, database, tableName string, primaryKeys []string) []ForeignKey
func GetPostgresReferencedForeignKeys ¶
func GetPostgresReferencedForeignKeys(schema, database, tableName string, primaryKeys []string) []ForeignKey
func GetReferencedForeignKeys ¶
func GetReferencedForeignKeys(database, tableName string) []ForeignKey
func NewForeignKey ¶
func NewForeignKey(constraintName, fkTableName, fkColumnName, pkTableName, pkColumnName string) ForeignKey
func (*ForeignKey) GetCamelCaseFKColumnName ¶
func (f *ForeignKey) GetCamelCaseFKColumnName() string
func (*ForeignKey) GetCamelCaseFKTableName ¶
func (f *ForeignKey) GetCamelCaseFKTableName() string
func (*ForeignKey) GetCamelCaseFKTableNamePlural ¶
func (f *ForeignKey) GetCamelCaseFKTableNamePlural() string
func (*ForeignKey) GetCamelCasePKColumnName ¶
func (f *ForeignKey) GetCamelCasePKColumnName() string
func (*ForeignKey) GetCamelCasePKTableName ¶
func (f *ForeignKey) GetCamelCasePKTableName() string
func (*ForeignKey) GetCamelCasePKTableNamePlural ¶
func (f *ForeignKey) GetCamelCasePKTableNamePlural() string
func (*ForeignKey) GetFKTableNamePluralInCase ¶ added in v0.0.301
func (f *ForeignKey) GetFKTableNamePluralInCase() string
func (*ForeignKey) GetFkColumnNameInCase ¶ added in v0.0.301
func (f *ForeignKey) GetFkColumnNameInCase(caseToReturn string) string
func (*ForeignKey) GetFkTableNameInCase ¶ added in v0.0.301
func (f *ForeignKey) GetFkTableNameInCase(caseToReturn string) string
func (*ForeignKey) GetPascalCaseFKColumnName ¶
func (f *ForeignKey) GetPascalCaseFKColumnName() string
func (*ForeignKey) GetPascalCaseFKTableName ¶
func (f *ForeignKey) GetPascalCaseFKTableName() string
func (*ForeignKey) GetPascalCaseFKTableNamePlural ¶
func (f *ForeignKey) GetPascalCaseFKTableNamePlural(caseToReturn string) string
func (*ForeignKey) GetPascalCasePKColumnName ¶
func (f *ForeignKey) GetPascalCasePKColumnName() string
func (*ForeignKey) GetPascalCasePKTableName ¶
func (f *ForeignKey) GetPascalCasePKTableName() string
func (*ForeignKey) GetPascalCasePKTableNamePlural ¶
func (f *ForeignKey) GetPascalCasePKTableNamePlural() string
func (*ForeignKey) GetPkColumnNameInCase ¶ added in v0.0.301
func (f *ForeignKey) GetPkColumnNameInCase(caseToReturn string) string
type GuiEdit ¶
type GuiEdit struct {
Columns []GuiListColumn `json:"columns"`
}
type GuiList ¶
type GuiList struct {
FirstColumn GuiListColumn `json:"firstColumn"`
Columns []GuiListColumn `json:"columns"`
}
type GuiListColumn ¶
type GuiListColumn struct {
ColumnName string `json:"columnName"`
Title string `json:"title"`
Value string `json:"value"`
GuiControl string `json:"guiControl"`
SelectOptions string `json:"selectOptions"`
SelectKey string `json:"selectKey"`
SelectValue string `json:"selectValue"`
SelectTableName string `json:"selectTableName"`
}
type GuiListTable ¶
type GuiListTable struct {
TableName string `json:"tableName"`
AllowAttachedFiles bool `json:"allowAttachedFiles"`
GuiList GuiList `json:"list"`
GuiEdit GuiEdit `json:"edit"`
}
func (*GuiListTable) GetEditGuiControlForColumn ¶
func (t *GuiListTable) GetEditGuiControlForColumn(columnName string) string
func (*GuiListTable) GetEditSelectKeyForColumn ¶
func (t *GuiListTable) GetEditSelectKeyForColumn(columnName string) string
func (*GuiListTable) GetEditSelectValueForColumn ¶
func (t *GuiListTable) GetEditSelectValueForColumn(columnName string) string
func (*GuiListTable) HasGuiControl ¶
func (t *GuiListTable) HasGuiControl(controlName string) bool
type GuiListTables ¶
type GuiListTables struct {
Tables []GuiListTable `json:"tables"`
}
func ReadGuiTables ¶
func ReadGuiTables(templateFile string) GuiListTables
type IntegrationTestSettings ¶
type IntegrationTestSettings struct {
PostgresUser, PostgresPassword, PostgresDbName, PostgresHost string
PostgresPort int
MySqlUser, MySqlPassword, MySqlDB string
}
func ReadIntegrationTestSettings ¶
func ReadIntegrationTestSettings(contextFile string) IntegrationTestSettings
type MySqlColumn ¶
type MySqlForeignKey ¶
type MySqlForeignKey struct {
TableName, ColumnName, ConstraintName, ReferencedColumnName, ReferencedTableName string
}
type OracleColumn ¶
type OracleColumn struct {
ColumnName, Nullable, DataType, IdentityColumn, DataDefault sql.NullString
DataPrecision, DataLength, DataScale sql.NullInt64
}
type OraclePrimaryKey ¶
type OraclePrimaryKey struct {
TableName, TableSchema, ConstraintName, Status, ColumnName string
OrdinalPosition int
}
func GetOraclePrimaryKeys ¶
func GetOraclePrimaryKeys(tableName, schema string) []OraclePrimaryKey
type OrmColumn ¶ added in v0.0.301
type OrmColumn struct {
ColumnName, OrmType, DatabaseType, PropertyName string
IsPrimaryKey, IsNullable, IsAutoIncrement bool
}
OrmColumn represents a database column with metadata for ORM transformations. It includes details such as column name, data types, property name, and constraints.
func (*OrmColumn) GetColumnNameInCase ¶ added in v0.0.301
GetColumnNameInCase returns the column name formatted in the specified case style (e.g., camel, snake, kebab, pascal).
func (*OrmColumn) GetPropertyNameInCase ¶ added in v0.0.301
GetPropertyNameInCase returns the PropertyName of the OrmColumn converted to the specified case format.
type OrmModel ¶ added in v0.0.301
OrmModel represents a database model with metadata for ORM transformations, including table and column details.
func ReadModels ¶ added in v0.0.21
ReadModels reads a JSON file containing ORM model definitions and unmarshals it into a slice of OrmModel.
func (*OrmModel) GetModelNameInCase ¶ added in v0.0.301
GetModelNameInCase returns the ModelName of the OrmModel converted to the specified case format.
func (*OrmModel) GetModelNamePluralInCase ¶ added in v0.0.302
GetModelNamePluralInCase ensures model name is pluralized in the case that is passed.
func (*OrmModel) GetModelTableNameInCase ¶ added in v0.0.301
GetModelTableNameInCase returns the TableName of the OrmModel converted to the specified case format.
func (*OrmModel) GetPrimaryModelColumns ¶ added in v0.0.302
func (*OrmModel) HasCompositePrimaryKey ¶ added in v0.0.302
type PostgresColumn ¶
type PostgresColumn struct {
OrdinalPosition int
NumericPrecision, CharacterMaximumLength, NumericScale *int
IsNullable, DataType, IsIdentity, ColumnDefault sql.NullString
}
type PostgresPrimaryKey ¶
type Table ¶
type Table struct {
TableName, DatabaseType string
Columns []Column
ForeignKeys []ForeignKey
ReferencedForeignKeys []ForeignKey
GuiListTable GuiListTable
}
Table represents the structure of a database table, including its name, type, columns, and foreign key relationships.
func GetMssqlTables ¶ added in v0.0.21
func GetOracleTables ¶
func GetPostgresTables ¶
func NewTable ¶
NewTable creates and returns a new Table instance with the specified table name and database type.
func ReadTables ¶
ReadTables reads a JSON file specified by templateFile and unmarshals its content into a slice of Table structs.
func (*Table) AddColumn ¶
AddColumn adds a new column to the table by appending it to the Columns slice.
func (*Table) GetCSharpFirstPrimaryUnitTestValue ¶
GetCSharpFirstPrimaryUnitTestValue retrieves the first unit test value of the primary key column from the table.
func (*Table) GetCSharpSecondPrimaryUnitTestValue ¶
GetCSharpSecondPrimaryUnitTestValue iterates through table columns to return the second primary key's unit test value in C#.
func (*Table) GetCamelCaseTableName ¶
GetCamelCaseTableName converts the table's name to camel case format and returns it as a string.
func (*Table) GetCamelCaseTableNameEF ¶
GetCamelCaseTableNameEF returns the table name in camelCase format, singularized if it is in plural form.
func (*Table) GetCamelCaseTableNamePlural ¶
GetCamelCaseTableNamePlural converts the table name to camel case and ensures it is pluralized.
func (*Table) GetColumnListWithCSharpTypes ¶
GetColumnListWithCSharpTypes generates a formatted string listing column names and their C# data types from the table.
func (*Table) GetFirstPrimaryColumn ¶
GetFirstPrimaryColumn returns the first column marked as a primary key within the table. Returns an empty Column if none found.
func (*Table) GetFirstPrimaryColumnCamelCaseColumnName ¶ added in v0.0.18
GetFirstPrimaryColumnCamelCaseColumnName retrieves the camel case name of the first primary key column in the table.
func (*Table) GetFirstPrimaryColumnJavaDataType ¶ added in v0.0.18
GetFirstPrimaryColumnJavaDataType returns the Java data type of the first primary key column in the table. If none, returns empty string.
func (*Table) GetFirstPrimaryColumnJavaFirstUnitTestValue ¶ added in v0.0.19
GetFirstPrimaryColumnJavaFirstUnitTestValue returns the Java first unit test value of the first primary key column in the table.
func (*Table) GetFirstPrimaryColumnJavaSecondUnitTestValue ¶ added in v0.0.19
GetFirstPrimaryColumnJavaSecondUnitTestValue retrieves the second unit test value of the first primary key column in the table.
func (*Table) GetFirstPrimaryColumnPascalCaseColumnName ¶ added in v0.0.18
GetFirstPrimaryColumnPascalCaseColumnName returns the PascalCase name of the first primary key column in the table.
func (*Table) GetFirstPrimaryColumnSetString ¶ added in v0.0.19
GetFirstPrimaryColumnSetString retrieves the set string of the first primary key column in the table, if one exists.
func (*Table) GetFirstPrimarySetString ¶ added in v0.0.19
GetFirstPrimarySetString returns the modified set string of the first column marked as a primary key in the table.
func (*Table) GetFkTableNameForColumn ¶
GetFkTableNameForColumn returns the primary key table name associated with the given foreign key column name.
func (*Table) GetJavaFirstPrimaryUnitTestValue ¶
GetJavaFirstPrimaryUnitTestValue returns the first unit test value of the primary key column in Java format for the table.
func (*Table) GetJavaFirstPrimaryUnitTestValueAsString ¶ added in v0.0.19
GetJavaFirstPrimaryUnitTestValueAsString returns the first Java unit test string value of the primary key in the table.
func (*Table) GetJavaSecondPrimaryUnitTestValue ¶
GetJavaSecondPrimaryUnitTestValue returns the second primary key's unit test value as a string from the table's columns.
func (*Table) GetJavaSecondPrimaryUnitTestValueAsString ¶ added in v0.0.19
GetJavaSecondPrimaryUnitTestValueAsString returns the second primary unit test value for a column as a modified string.
func (*Table) GetNullableColumns ¶
GetNullableColumns returns a slice of columns that are marked as nullable in the table.
func (*Table) GetPascalCaseTableName ¶
GetPascalCaseTableName returns the table name converted to PascalCase format.
func (*Table) GetPascalCaseTableNameEF ¶
GetPascalCaseTableNameEF converts the table name to PascalCase format and ensures it's singular if it is plural.
func (*Table) GetPascalCaseTableNamePlural ¶
GetPascalCaseTableNamePlural returns the table name in PascalCase format, ensuring the name is pluralized.
func (*Table) GetPrimaryColumnJavaTypesAndVariables ¶ added in v0.0.17
GetPrimaryColumnJavaTypesAndVariables returns a string containing Java types and variables for primary key columns. The returned string is formatted as "Type1 var1, Type2 var2" for all primary key columns in the table.
func (*Table) GetPrimaryColumnVariables ¶ added in v0.0.17
GetPrimaryColumnVariables returns a comma-separated string of camel case names for all primary key columns in the table.
func (*Table) GetPrimaryColumns ¶
GetPrimaryColumns returns a slice of Column objects that are marked as primary keys from the table's columns.
func (*Table) GetPrimaryNonDateColumns ¶ added in v0.0.20
GetPrimaryNonDateColumns retrieves all primary key columns from the table that are not of "Date" or "Timestamp" type.
func (*Table) GetTableName ¶
GetTableName returns the name of the table associated with the Table instance.
func (*Table) GetTableNameInCase ¶ added in v0.0.301
func (*Table) HasAnyDateColumn ¶ added in v0.0.17
HasAnyDateColumn checks if the table contains at least one column with a date-related data type such as date, datetime, year, or timestamp.
func (*Table) HasAutoIncrementColumn ¶
HasAutoIncrementColumn checks if the table contains at least one column with the auto-increment property.
func (*Table) HasCompositePrimaryKey ¶
HasCompositePrimaryKey checks if the table has a composite primary key by verifying if it has more than one primary column.
func (*Table) HasDateColumn ¶
HasDateColumn checks if the table contains at least one column with a "date" data type and returns true if found.
func (*Table) HasDateTimeColumn ¶ added in v0.0.17
HasDateTimeColumn checks if the table contains at least one column with the "datetime" data type. Returns true if found.
func (*Table) HasJavaTypeColumn ¶ added in v0.0.17
HasJavaTypeColumn checks if the table contains a column with the specified Java data type.
func (*Table) HasJavascriptNumberColumn ¶
HasJavascriptNumberColumn checks if the table has at least one column with the JavaScript data type "Number".
func (*Table) HasJavascriptStringColumn ¶
HasJavascriptStringColumn checks if the table contains at least one column with a JavaScript data type of "String".
func (*Table) HasTimestampColumn ¶ added in v0.0.17
HasTimestampColumn checks if the table contains at least one column with the "timestamp" data type. Returns true if found.
func (*Table) HasYearColumn ¶ added in v0.0.17
HasYearColumn checks if the table contains at least one column with a data type of "year".
type Template ¶
type Template struct {
TemplateFile string `json:"templateFile"`
GeneratedFileName string `json:"generatedFileName"`
GeneratedFolderName string `json:"generatedFolderName"`
OutputPath string `json:"outputPath"`
AppendFile bool `json:"appendFile"`
OverwriteFile bool `json:"overwriteFile"`
UnitTestJsonJava string `json:"unitTestJsonJava"`
UnitTestJsonCSharp string `json:"UnitTestJsonCSharp"`
ForeignKeyMapping string `json:"foreignKeyMapping"`
MinimumGeneratedFileLength int `json:"minimumGeneratedFileLength"`
CopyOnly bool `json:"copyOnly"`
}
func NewTemplate ¶
type Templates ¶
type Templates struct {
Templates []Template `json:"templates"`
Tags []Tag `json:"tags"`
IgnoreTables []string `json:"ignoreTables"`
IncludeTables []string `json:"includeTables"`
}
func ReadTemplates ¶
type UnitTestValue ¶
type UnitTestValueColumn ¶
type UnitTestValueColumn struct {
ColumnName string `json:"columnName"`
UnitTestValues []UnitTestValue `json:"unitTestValues"`
}
type UnitTestValueTable ¶
type UnitTestValueTable struct {
TableName string `json:"tableName"`
Columns []UnitTestValueColumn `json:"columns"`
}
type UnitTestValueTables ¶
type UnitTestValueTables struct {
Tables []UnitTestValueTable `json:"tables"`
}
func ReadUnitTestValues ¶
func ReadUnitTestValues(unitTestFile string) UnitTestValueTables