DBSchema

package
v0.7.85 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false
View Source
var TypeBigIntegers = []string{
	"bigint",
	"int8",
	"LONG",
}
View Source
var TypeBinaries = []string{
	"binary",
	"blob",
	"longblob",
	"mediumblob",
	"varbinary",
	"BFILE",
	"BLOB",
}
View Source
var TypeBool = []string{
	"bool",
}
View Source
var TypeDates = []string{}
View Source
var TypeFloat32 = []string{
	"float",
	"float8",
	"float4",
	"real",
	"FLOAT",
	"NUMBER",
}
View Source
var TypeFloat64 = []string{
	"decimal",
	"double",
	"numeric",
	"BINARY_FLOAT",
	"BINARY_DOUBLE",
	"DECIMAL",
}
View Source
var TypeGeo = []string{}
View Source
var TypeIntegers = []string{
	"tinyint",
	"int",
	"smallint",
	"mediumint",
	"int4",
	"int2",
	"year",
	"SMALLINT",
	"INT",
	"INTEGER",
}
View Source
var TypeSecure = []string{
	"secure",
}
View Source
var TypeStrings = []string{
	"char",
	"enum",
	"varchar",
	"nvarchar",
	"longtext",
	"mediumtext",
	"text",
	"ntext",
	"tinytext",
	"uuid",
	"bpchar",
	"CHARACTER",
	"VARCHAR",
	"VARCHAR2",
	"NVARCHAR2",
	"CLOB",
	"CHAR",
	"NCHAR",
	"NCLOB",
	"JSON",
	"JSONB",
	"json",
	"ROWID",
	"UROWID",
	"jsonb",
	"time",
	"geometry",
}
View Source
var TypeTimes = []string{
	"datetimeoffset",
	"timestamptz",
	"TIMESTAMP(6) WITH TIME ZONE",
	"TIMESTAMP(6) WITH LOCAL TIME ZONE",
	"TIMESTAMP",
	"TIMESTAMP(6)",
	"datetime",
	"date",
	"DATE",
	"timestamp",
	"TIMESTAMP",
}

Functions

func FieldName

func FieldName(s string) string

func FmtFieldName

func FmtFieldName(s string) string

func Generate

func Generate(columnTypes []generatorModels.ColumnData, tableName string, structName string, pkgName string, jsonAnnotation bool, gormAnnotation bool, gureguTypes bool, extraColumns string, extraStucts string) ([]byte, error)

func GenerateGrapql

func GenerateGrapql(columnTypes []generatorModels.ColumnData, tableName string, structName string, pkgName string, jsonAnnotation bool, gormAnnotation bool, gureguTypes bool, extraColumns string, extraStucts string, Subs []string, isInpute bool) ([]byte, error)

func GenerateGrapqlOrder

func GenerateGrapqlOrder(columnTypes []generatorModels.ColumnData, tableName string, structName string, pkgName string, jsonAnnotation bool, gormAnnotation bool, gureguTypes bool, extraColumns string, extraStucts string) ([]byte, error)

func GenerateOnlyStruct

func GenerateOnlyStruct(columnTypes []generatorModels.ColumnData, tableName string, structName string, pkgName string, jsonAnnotation bool, gormAnnotation bool, gureguTypes bool, extraColumns string, extraStucts string) ([]byte, error)

func GenerateProtobuf

func GenerateProtobuf(columnTypes []generatorModels.ColumnData, tableName string, structName string, pkgName string, jsonAnnotation bool, gormAnnotation bool, gureguTypes bool, extraColumns string, extraStucts string, Subs []string, isInpute bool) ([]byte, error)

func GenerateSchemaForCloud

func GenerateSchemaForCloud() models.DBSCHEMA

func GenerateWithImports

func GenerateWithImports(otherPackage string, columnTypes []generatorModels.ColumnData, tableName string, structName string, pkgName string, jsonAnnotation bool, gormAnnotation bool, gureguTypes bool, extraColumns string, extraStucts string, virtualColums string) ([]byte, error)

func GenerateWithImportsNoTime

func GenerateWithImportsNoTime(otherPackage string, columnTypes []generatorModels.ColumnData, tableName string, structName string, pkgName string, jsonAnnotation bool, gormAnnotation bool, gureguTypes bool, extraColumns string, extraStucts string) ([]byte, error)

func GetColumns

func GetColumns(db *sql.DB, dbTable string, hiddenColumns []string) (string, error)

func GetColumnsFromSQLlTable

func GetColumnsFromSQLlTable(db *sql.DB, dbTable string, hiddenColumns []string) ([]generatorModels.ColumnData, error)

func GetColumnsWithMeta

func GetColumnsWithMeta(db *sql.DB, dbTable string, hiddenColumns []string) ([]map[string]string, error)

func GetDBSchema

func GetDBSchema() models.DBSCHEMA

func GetOnlyOneField

func GetOnlyOneField(db *sql.DB, dbTable string, oneField string) (*map[string]map[string]string, error)

func GetTableSchema

func GetTableSchema(columnTypes []generatorModels.ColumnData) string

func IsSecureField

func IsSecureField(table, column, dataType string) string

func LcFirst

func LcFirst(s string) string

func StringifyFirstChar

func StringifyFirstChar(str string) string

func TableColumns

func TableColumns(table string, hiddenColumns []string) string

func TableColumnsWithMeta

func TableColumnsWithMeta(table string, hiddenColumns []string) []map[string]string

func TableMetas

func TableMetas(tableName string) []models.TableMeta

func TableToGraphql

func TableToGraphql(table string, hiddenColumns []string, Subs []string, isInpute bool) string

func TableToGraphqlOrderBy

func TableToGraphqlOrderBy(table string, hiddenColumns []string) string

func TableToStruct

func TableToStruct(table string, hiddenColumns []string, pkgName string, Subs []string) string

func TableToStructNoTime

func TableToStructNoTime(table string, hiddenColumns []string, pkgName string) string

func Tables

func Tables() map[string][]string

func TablesForCloud

func TablesForCloud() map[string][]string

func ToGo

func ToGo(name string) string

func TypeContains

func TypeContains(v string, a []string) bool

func UcFirst

func UcFirst(s string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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