models

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

Functions

func CheckError

func CheckError(err error)

func CloseDB

func CloseDB()

func ConnectDB

func ConnectDB(userName, password, dbname string)

func ConnectOracleDB

func ConnectOracleDB(user, password, server, service string, port int)

func ConnectPostgresDB

func ConnectPostgresDB(user, password, dbname, host string, port int)

func GetCSharpDataTypeForMySql

func GetCSharpDataTypeForMySql(dataType string, numericPrecision int) string

func GetCSharpDataTypeForOracle

func GetCSharpDataTypeForOracle(dataType string, numericPrecision int) string

func GetCSharpDataTypeForPostgres

func GetCSharpDataTypeForPostgres(dataType string, numericPrecision int) string

func GetCSharpFirstUnitTestValueForMySql

func GetCSharpFirstUnitTestValueForMySql(dataType string) string

func GetCSharpFirstUnitTestValueForOracle

func GetCSharpFirstUnitTestValueForOracle(dataType string) string

func GetCSharpFirstUnitTestValueForPostgres

func GetCSharpFirstUnitTestValueForPostgres(dataType string) string

func GetCSharpSecondUnitTestValueForMySql

func GetCSharpSecondUnitTestValueForMySql(dataType string) string

func GetCSharpSecondUnitTestValueForOracle

func GetCSharpSecondUnitTestValueForOracle(dataType string) string

func GetCSharpSecondUnitTestValueForPostgres

func GetCSharpSecondUnitTestValueForPostgres(dataType string) string

func GetColumnNames

func GetColumnNames(schema, tableName string) []string

func GetGoDataTypeForMySql

func GetGoDataTypeForMySql(dataType string, numericPrecision int) string

func GetGoDataTypeForOracle

func GetGoDataTypeForOracle(dataType string) string

func GetGoDataTypeForPostgres

func GetGoDataTypeForPostgres(dataType string) string

func GetGoFirstUnitTestValueForMySql

func GetGoFirstUnitTestValueForMySql(dataType string, numericPrecision int) string

func GetGoFirstUnitTestValueForOracle

func GetGoFirstUnitTestValueForOracle(dataType string) string

func GetGoFirstUnitTestValueForPostgres

func GetGoFirstUnitTestValueForPostgres(dataType string) string

func GetGoSecondUnitTestValueForMySql

func GetGoSecondUnitTestValueForMySql(dataType string, numericPrecision int) string

func GetGoSecondUnitTestValueForOracle

func GetGoSecondUnitTestValueForOracle(dataType string) string

func GetGoSecondUnitTestValueForPostgres

func GetGoSecondUnitTestValueForPostgres(dataType string) string

func GetJavaDataTypeForMySql

func GetJavaDataTypeForMySql(dataType string, numericPrecision int) string

func GetJavaDataTypeForOracle

func GetJavaDataTypeForOracle(dataType string, numericPrecision int) string

func GetJavaDataTypeForPostgres

func GetJavaDataTypeForPostgres(dataType string, numericPrecision int) string

func GetJavaFirstUnitTestValueForMySql

func GetJavaFirstUnitTestValueForMySql(dataType string) string

func GetJavaFirstUnitTestValueForOracle

func GetJavaFirstUnitTestValueForOracle(dataType string) string

func GetJavaFirstUnitTestValueForPostgres

func GetJavaFirstUnitTestValueForPostgres(dataType string) string

func GetJavaSecondUnitTestValueForMySql

func GetJavaSecondUnitTestValueForMySql(dataType string) string

func GetJavaSecondUnitTestValueForOracle

func GetJavaSecondUnitTestValueForOracle(dataType string) string

func GetJavaSecondUnitTestValueForPostgres

func GetJavaSecondUnitTestValueForPostgres(dataType string) string

func GetJavascriptDataTypeForMySql

func GetJavascriptDataTypeForMySql(dataType string, numericPrecision int) string

func GetJavascriptDataTypeForOracle

func GetJavascriptDataTypeForOracle(dataType string, numericPrecision int) string

func GetJavascriptDataTypeForPostgres

func GetJavascriptDataTypeForPostgres(dataType string, numericPrecision int) string

func GetJavascriptDefaultValueForMySql

func GetJavascriptDefaultValueForMySql(dataType string, numericPrecision int) string

func GetJavascriptDefaultValueForOracle

func GetJavascriptDefaultValueForOracle(dataType string, numericPrecision int) string

func GetJavascriptDefaultValueForPostgres

func GetJavascriptDefaultValueForPostgres(dataType string, numericPrecision int) string

func GetPkColumnName

func GetPkColumnName(columnName string, keys []ForeignKey) string

func GetPkTableName

func GetPkTableName(columnName string, keys []ForeignKey) string

func GetPostgresPrimaryKeys

func GetPostgresPrimaryKeys(tableName, schema string) []string

func GetTableNames

func GetTableNames(schema string) []string

func GetTableNamesOracle

func GetTableNamesOracle() []string

func GetTableNamesPostgres

func GetTableNamesPostgres(schema string) []string

func IsColumnForeignKey

func IsColumnForeignKey(columnName string, keys []ForeignKey) bool

func MakeTitle added in v0.0.12

func MakeTitle(s string) string

Types

type Actor

type Actor struct {
	// contains filtered or unexported fields
}

type Column

type Column struct {
	ColumnName, DataType, DatabaseType, TableName, PkTableName, PkColumnName string
	IsPrimaryKey, IsNullable, IsAutoIncrement, IsForeignKey                  bool
	OrdinalPosition, NumericPrecision, NumericScale, CharacterMaximumLength  int
}

func GetColumn

func GetColumn(schema, columnName, tableName string) Column

func GetColumnPostgres

func GetColumnPostgres(schema, columnName, tableName, database string, primaryKeys []string) Column

func GetColumnsOracle

func GetColumnsOracle(tableName, schema string, primaryKeys []OraclePrimaryKey, fks []ForeignKey) []Column

func GetPostgresColumns

func GetPostgresColumns(tableName, schema, database string, fks []ForeignKey) []Column

func NewColumn

func NewColumn(columnName, databaseType, tableName string) Column

func (*Column) GetAspNetRouteConstraintType

func (c *Column) GetAspNetRouteConstraintType() string

func (*Column) GetCSharpDataType

func (c *Column) GetCSharpDataType() string

func (*Column) GetCSharpFirstUnitTestValue

func (c *Column) GetCSharpFirstUnitTestValue() string

func (*Column) GetCSharpFirstUnitTestValueFromFile

func (c *Column) GetCSharpFirstUnitTestValueFromFile(valuesFile string) string

func (*Column) GetCSharpSecondUnitTestValue

func (c *Column) GetCSharpSecondUnitTestValue() string

func (*Column) GetCSharpSecondUnitTestValueFromFile

func (c *Column) GetCSharpSecondUnitTestValueFromFile(valuesFile string) string

func (*Column) GetCamelCaseColumnName

func (c *Column) GetCamelCaseColumnName() string

func (*Column) GetGoDataType

func (c *Column) GetGoDataType() string

func (*Column) GetGoFirstUnitTestValue

func (c *Column) GetGoFirstUnitTestValue() string

func (*Column) GetGoSecondUnitTestValue

func (c *Column) GetGoSecondUnitTestValue() string

func (*Column) GetJavaDataType

func (c *Column) GetJavaDataType() string

func (*Column) GetJavaFirstUnitTestValue

func (c *Column) GetJavaFirstUnitTestValue() string

func (*Column) GetJavaFirstUnitTestValueFromFile

func (c *Column) GetJavaFirstUnitTestValueFromFile(valuesFile string) string

func (*Column) GetJavaSecondUnitTestValue

func (c *Column) GetJavaSecondUnitTestValue() string

func (*Column) GetJavaSecondUnitTestValueFromFile

func (c *Column) GetJavaSecondUnitTestValueFromFile(valuesFile string) string

func (*Column) GetJavascriptDataType

func (c *Column) GetJavascriptDataType() string

func (*Column) GetJavascriptDefaultValue

func (c *Column) GetJavascriptDefaultValue() string

func (*Column) GetPascalCaseColumnName

func (c *Column) GetPascalCaseColumnName() string

func (*Column) GetPascalCaseTableName

func (c *Column) GetPascalCaseTableName() string

func (*Column) GetSetString

func (c *Column) GetSetString() string

func (*Column) GetSetStringJson

func (c *Column) GetSetStringJson() string

func (*Column) GetTitleCaseColumnName added in v0.0.12

func (c *Column) GetTitleCaseColumnName() string

func (*Column) GetTitleCaseTableName added in v0.0.12

func (c *Column) GetTitleCaseTableName() string

func (*Column) IsBinary

func (c *Column) IsBinary() bool

func (*Column) IsGoIntFamilyType added in v0.0.9

func (c *Column) IsGoIntFamilyType() bool

func (*Column) Test

func (c *Column) Test() string

type ForeignKey

type ForeignKey struct {
	ConstraintName, FkTableName, FkColumnName, PkTableName, PkColumnName, Relation string
	FkColumn, PkColumn                                                             Column
}

func GetForeignKeys

func GetForeignKeys(database, tableName 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) GetPascalCaseFKColumnName

func (f *ForeignKey) GetPascalCaseFKColumnName() string

func (*ForeignKey) GetPascalCaseFKTableName

func (f *ForeignKey) GetPascalCaseFKTableName() string

func (*ForeignKey) GetPascalCaseFKTableNamePlural

func (f *ForeignKey) GetPascalCaseFKTableNamePlural() 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

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 MySqlColumn struct {
	OrdinalPosition                          int
	NumericPrecision, CharacterMaximumLength *int
	IsNullable, DataType, Extra, ColumnKey   string
}

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 PostgresColumn

type PostgresColumn struct {
	OrdinalPosition                                        int
	NumericPrecision, CharacterMaximumLength, NumericScale *int
	IsNullable, DataType, IsIdentity, ColumnDefault        string
}

type PostgresPrimaryKey

type PostgresPrimaryKey struct {
	TableName, TableSchema, ConstraintName, ColumnName string
	OrdinalPosition                                    int
}

type Table

type Table struct {
	TableName, DatabaseType string
	Columns                 []Column
	ForeignKeys             []ForeignKey
	ReferencedForeignKeys   []ForeignKey
	GuiListTable            GuiListTable
}

func GetOracleTables

func GetOracleTables(schema string) []Table

func GetPostgresTables

func GetPostgresTables(schema, database string) []Table

func GetTables

func GetTables(schema string) []Table

func NewTable

func NewTable(tableName, databaseType string) Table

func ReadTables

func ReadTables(templateFile string) []Table

func (*Table) AddColumn

func (t *Table) AddColumn(column Column)

func (*Table) GetCSharpFirstPrimaryUnitTestValue

func (t *Table) GetCSharpFirstPrimaryUnitTestValue() string

func (*Table) GetCSharpSecondPrimaryUnitTestValue

func (t *Table) GetCSharpSecondPrimaryUnitTestValue() string

func (*Table) GetCamelCaseTableName

func (t *Table) GetCamelCaseTableName() string

func (*Table) GetCamelCaseTableNameEF

func (t *Table) GetCamelCaseTableNameEF() string

func (*Table) GetCamelCaseTableNamePlural

func (t *Table) GetCamelCaseTableNamePlural() string

func (*Table) GetColumnListWithCSharpTypes

func (t *Table) GetColumnListWithCSharpTypes() string

func (*Table) GetFirstPrimaryColumn

func (t *Table) GetFirstPrimaryColumn() Column

func (*Table) GetFkTableNameForColumn

func (t *Table) GetFkTableNameForColumn(columnName string) string

func (*Table) GetJavaFirstPrimaryUnitTestValue

func (t *Table) GetJavaFirstPrimaryUnitTestValue() string

func (*Table) GetJavaSecondPrimaryUnitTestValue

func (t *Table) GetJavaSecondPrimaryUnitTestValue() string

func (*Table) GetNullableColumns

func (t *Table) GetNullableColumns() []Column

func (*Table) GetPascalCaseTableName

func (t *Table) GetPascalCaseTableName() string

func (*Table) GetPascalCaseTableNameEF

func (t *Table) GetPascalCaseTableNameEF() string

func (*Table) GetPascalCaseTableNamePlural

func (t *Table) GetPascalCaseTableNamePlural() string

func (*Table) GetPrimaryColumns

func (t *Table) GetPrimaryColumns() []Column

func (*Table) GetTableName

func (t *Table) GetTableName() string

func (*Table) HasAutoIncrementColumn

func (t *Table) HasAutoIncrementColumn() bool

func (*Table) HasCompositePrimaryKey

func (t *Table) HasCompositePrimaryKey() bool

func (*Table) HasDateColumn

func (t *Table) HasDateColumn() bool

func (*Table) HasJavascriptNumberColumn

func (t *Table) HasJavascriptNumberColumn() bool

func (*Table) HasJavascriptStringColumn

func (t *Table) HasJavascriptStringColumn() bool

type Tag

type Tag struct {
	TagName string `json:"tagName"`
	Value   string `json:"value"`
}

func NewTag

func NewTag(tagName, value string) Tag

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

func NewTemplate(templateFile, generatedFileName, generatedFolderName, outputPath string) Template

type Templates

type Templates struct {
	Templates     []Template `json:"templates"`
	Tags          []Tag      `json:"tags"`
	IgnoreTables  []string   `json:"ignoreTables"`
	IncludeTables []string   `json:"includeTables"`
}

func ReadTemplates

func ReadTemplates(templateFile string) Templates

type UnitTestValue

type UnitTestValue struct {
	FirstUnitTestValue  string `json:"firstUnitTestValue"`
	SecondUnitTestValue string `json:"secondUnitTestValue"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL