Documentation ¶
Index ¶
Constants ¶
View Source
const ( // TypePGInt2 is a postgres type TypePGInt2 = "int2" // TypePGInt4 is a postgres type TypePGInt4 = "int4" // TypePGInt8 is a postgres type TypePGInt8 = "int8" // TypePGNumeric is a postgres type TypePGNumeric = "numeric" // TypePGFloat4 is a postgres type TypePGFloat4 = "float4" // TypePGFloat8 is a postgres type TypePGFloat8 = "float8" // TypePGText is a postgres type TypePGText = "text" // TypePGVarchar is a postgres type TypePGVarchar = "varchar" // TypePGUuid is a postgres type TypePGUuid = "uuid" // TypePGBpchar is a postgres type TypePGBpchar = "bpchar" // TypePGBytea is a postgres type TypePGBytea = "bytea" // TypePGBool is a postgres type TypePGBool = "bool" // TypePGTimestamp is a postgres type TypePGTimestamp = "timestamp" // TypePGTimestamptz is a postgres type TypePGTimestamptz = "timestamptz" // TypePGDate is a postgres type TypePGDate = "date" // TypePGTime is a postgres type TypePGTime = "time" // TypePGTimetz is a postgres type TypePGTimetz = "timetz" // TypePGInterval is a postgres type TypePGInterval = "interval" // TypePGJSONB is a postgres type TypePGJSONB = "jsonb" // TypePGJSON is a postgres type TypePGJSON = "json" // TypePGHstore is a postgres type TypePGHstore = "hstore" // TypePGInet is a postgres type TypePGInet = "inet" // TypePGCidr is a postgres type TypePGCidr = "cidr" // TypePGPoint is a postgres type TypePGPoint = "point" // TypeInt is a go type TypeInt = "int" // TypeInt32 is a go type TypeInt32 = "int32" // TypeInt64 is a go type TypeInt64 = "int64" // TypeFloat32 is a go type TypeFloat32 = "float32" // TypeFloat64 is a go type TypeFloat64 = "float64" // TypeString is a go type TypeString = "string" // TypeByte is a go type TypeByte = "byte" // TypeBool is a go type TypeBool = "bool" // TypeTime is a go type TypeTime = "time.Time" // TypeDuration is a go type TypeDuration = "time.Duration" // TypeMapInterface is a go type TypeMapInterface = "map[string]interface{}" // TypeMapString is a go type TypeMapString = "map[string]string" // TypeIP is a go type TypeIP = "net.IP" // TypeIPNet is a go type TypeIPNet = "net.IPNet" // TypeInterface is a go type TypeInterface = "interface{}" )
Variables ¶
This section is empty.
Functions ¶
func GoNullable ¶
GoNullable generates all go types from pg type with pointer
Types ¶
type Column ¶
type Column struct { GoName string PGName string Type string GoType string PGType string Nullable bool IsArray bool Dimensions int IsPK bool IsFK bool Relation *Relation Import string MaxLen int Values []string }
Column stores information about column
func NewColumn ¶
func NewColumn(pgName string, pgType string, nullable, sqlNulls, array bool, dims int, pk, fk bool, len int, values []string) Column
NewColumn creates Column from pg info
func (*Column) AddRelation ¶
AddRelation adds relation to column. Should be used if FK
type Entity ¶
type Entity struct { GoName string GoNamePlural string PGName string PGSchema string PGFullName string ViewName string Columns []Column Relations []Relation Imports []string // contains filtered or unexported fields }
Entity stores information about table
func (*Entity) AddRelation ¶
AddRelation adds relation to entity
func (*Entity) HasMultiplePKs ¶
HasMultiplePKs checks if entity has many primary keys
Click to show internal directories.
Click to hide internal directories.