Documentation ¶
Index ¶
- Constants
- func ConvertToSnakeCase(input string) string
- type BoolDBField
- type EnumDBField
- type Field
- func (f *Field) CanBeGreater() bool
- func (f *Field) CanTime() bool
- func (f *Field) CanUUID() bool
- func (f *Field) GetAddressType() string
- func (f *Field) GetBaseType() string
- func (f *Field) GetDBName() string
- func (f *Field) GetFieldType() int
- func (f *Field) GetName() string
- func (f *Field) GetNameLower() string
- func (f *Field) GetNameTitle() string
- func (f *Field) GetRequiredPackages() []string
- func (f *Field) GetType() string
- func (f *Field) IsCustomType() bool
- func (f *Field) IsDefault() bool
- func (f *Field) IsNillable() bool
- func (f *Field) IsSerial() bool
- func (f *Field) NeedPrepare() bool
- func (f *Field) SetDBName(v string)
- func (f *Field) SetDBNameManually(name string)
- func (f *Field) SetNillable() *Field
- type FieldI
- type Float32DBField
- type Float64DBField
- type FuncStruct
- type Generation
- type IntDBField
- type Relation
- type StringDBField
- type Table
- type TimeDBField
- type UUIDDBField
- type UintDBField
Constants ¶
View Source
const ( FieldTypeBool = iota + 1 FieldTypeEnum FieldTypeInt FieldTypeSmallInt FieldTypeBigInt FieldTypeFloat32 FieldTypeFloat64 FieldTypeString FieldTypeTime FieldTypeUUID FieldTypeUint )
View Source
const ( RelationTypeManyToOne = iota RelationTypeOneToMany RelationTypeManyToMany )
Variables ¶
This section is empty.
Functions ¶
func ConvertToSnakeCase ¶
Types ¶
type BoolDBField ¶
type BoolDBField struct { *Field DefaultValue bool DefaultFuncStruct *FuncStruct }
func BoolField ¶
func BoolField(name string) *BoolDBField
func (*BoolDBField) Default ¶
func (i *BoolDBField) Default(v bool) *BoolDBField
func (*BoolDBField) DefaultFunc ¶
func (i *BoolDBField) DefaultFunc(v func() bool) *BoolDBField
func (*BoolDBField) GetDefault ¶
func (i *BoolDBField) GetDefault() string
func (*BoolDBField) SetDBName ¶
func (i *BoolDBField) SetDBName(v string) *BoolDBField
type EnumDBField ¶
type EnumDBField struct { *Field DefaultValue string DefaultFuncStruct *FuncStruct TypeName string Values []string }
func EnumField ¶
func EnumField(name string, values []string) *EnumDBField
func (*EnumDBField) Default ¶
func (s *EnumDBField) Default(v string) *EnumDBField
func (*EnumDBField) DefaultFunc ¶
func (s *EnumDBField) DefaultFunc(v func() string) *EnumDBField
func (*EnumDBField) GetDefault ¶
func (s *EnumDBField) GetDefault() string
func (*EnumDBField) SetDBName ¶
func (s *EnumDBField) SetDBName(v string) *EnumDBField
type Field ¶
type Field struct { FieldType int Name string DBName string Type string BaseType string Nillable bool HaveDefault bool IsPrepare bool IsGreater bool HaveCustomType bool IsTime bool IsUUID bool Serial bool RequiredPackages []string }
func (*Field) CanBeGreater ¶
func (*Field) GetAddressType ¶
func (*Field) GetBaseType ¶
func (*Field) GetFieldType ¶
func (*Field) GetNameLower ¶
func (*Field) GetNameTitle ¶
func (*Field) GetRequiredPackages ¶
func (*Field) IsCustomType ¶
func (*Field) IsNillable ¶
func (*Field) NeedPrepare ¶
func (*Field) SetDBNameManually ¶
func (*Field) SetNillable ¶
type Float32DBField ¶
type Float32DBField struct { *Field DefaultValue int DefaultFuncStruct *FuncStruct }
func Float32Field ¶
func Float32Field(name string) *Float32DBField
func (*Float32DBField) Default ¶
func (i *Float32DBField) Default(v int) *Float32DBField
func (*Float32DBField) DefaultFunc ¶
func (i *Float32DBField) DefaultFunc(v func() int) *Float32DBField
func (*Float32DBField) GetDefault ¶
func (i *Float32DBField) GetDefault() string
func (*Float32DBField) SetDBName ¶
func (i *Float32DBField) SetDBName(v string) *Float32DBField
type Float64DBField ¶
type Float64DBField struct { *Field DefaultValue int DefaultFuncStruct *FuncStruct }
func Float64Field ¶
func Float64Field(name string) *Float64DBField
func (*Float64DBField) Default ¶
func (i *Float64DBField) Default(v int) *Float64DBField
func (*Float64DBField) DefaultFunc ¶
func (i *Float64DBField) DefaultFunc(v func() int) *Float64DBField
func (*Float64DBField) GetDefault ¶
func (i *Float64DBField) GetDefault() string
func (*Float64DBField) SetDBName ¶
func (i *Float64DBField) SetDBName(v string) *Float64DBField
type FuncStruct ¶
func (*FuncStruct) DefaultFunc ¶
func (f *FuncStruct) DefaultFunc(v any)
type Generation ¶
type Generation struct {
Tables []*Table
}
type IntDBField ¶
type IntDBField struct { *Field DefaultValue int DefaultFuncStruct *FuncStruct }
func IntField ¶
func IntField(name string) *IntDBField
func (*IntDBField) AddSerial ¶
func (i *IntDBField) AddSerial() *IntDBField
func (*IntDBField) Default ¶
func (i *IntDBField) Default(v int) *IntDBField
func (*IntDBField) DefaultFunc ¶
func (i *IntDBField) DefaultFunc(v func() int) *IntDBField
func (*IntDBField) GetDefault ¶
func (i *IntDBField) GetDefault() string
func (*IntDBField) SetDBName ¶
func (i *IntDBField) SetDBName(v string) *IntDBField
type Relation ¶
type Relation struct { RelationTable string RelationTableDBName string RelationField string OnField string ManyTableDBName string RelationTableField string RelationType int }
func ManyToMany ¶
func (*Relation) GetRelationField ¶
func (*Relation) GetRelationTableLower ¶
func (*Relation) IsManyToMany ¶
func (*Relation) IsRelationList ¶
type StringDBField ¶
type StringDBField struct { *Field DefaultValue string DefaultFuncStruct *FuncStruct }
func StringField ¶
func StringField(name string) *StringDBField
func (*StringDBField) Default ¶
func (s *StringDBField) Default(v string) *StringDBField
func (*StringDBField) DefaultFunc ¶
func (s *StringDBField) DefaultFunc(v func() string) *StringDBField
func (*StringDBField) GetDefault ¶
func (s *StringDBField) GetDefault() string
func (*StringDBField) SetDBName ¶
func (s *StringDBField) SetDBName(v string) *StringDBField
type Table ¶
type Table struct { PackageName string TableName string DBName string IDField string IDDBField string IDFieldType string Fields []FieldI Relations []*Relation IDColumn FieldI RequiredPackages []string }
func (*Table) IDFieldLower ¶
func (*Table) SetIDField ¶
func (*Table) SetTableName ¶
type TimeDBField ¶
type TimeDBField struct { *Field DefaultFuncStruct *FuncStruct }
func TimeField ¶
func TimeField(name string) *TimeDBField
func (*TimeDBField) DefaultFunc ¶
func (t *TimeDBField) DefaultFunc(v func() time.Time) *TimeDBField
func (*TimeDBField) GetDefault ¶
func (t *TimeDBField) GetDefault() string
func (*TimeDBField) PrepareFunc ¶
func (t *TimeDBField) PrepareFunc() string
func (*TimeDBField) SetDBName ¶
func (t *TimeDBField) SetDBName(v string) *TimeDBField
func (*TimeDBField) SetNillable ¶
func (t *TimeDBField) SetNillable() *TimeDBField
type UUIDDBField ¶
type UUIDDBField struct { *Field DefaultFuncStruct *FuncStruct }
func UUIDField ¶
func UUIDField(name string) *UUIDDBField
func (*UUIDDBField) DefaultFunc ¶
func (u *UUIDDBField) DefaultFunc(v func() uuid.UUID) *UUIDDBField
func (*UUIDDBField) GetDefault ¶
func (u *UUIDDBField) GetDefault() string
func (*UUIDDBField) PrepareFunc ¶
func (u *UUIDDBField) PrepareFunc() string
func (*UUIDDBField) SetDBName ¶
func (u *UUIDDBField) SetDBName(v string) *UUIDDBField
func (*UUIDDBField) SetNillable ¶
func (u *UUIDDBField) SetNillable() *UUIDDBField
type UintDBField ¶
type UintDBField struct { *Field DefaultValue uint DefaultFuncStruct *FuncStruct }
func UintField ¶
func UintField(name string) *UintDBField
func (*UintDBField) AddSerial ¶
func (i *UintDBField) AddSerial() *UintDBField
func (*UintDBField) Default ¶
func (i *UintDBField) Default(v uint) *UintDBField
func (*UintDBField) DefaultFunc ¶
func (i *UintDBField) DefaultFunc(v func() uint) *UintDBField
func (*UintDBField) GetDefault ¶
func (i *UintDBField) GetDefault() string
func (*UintDBField) SetDBName ¶
func (i *UintDBField) SetDBName(v string) *UintDBField
Click to show internal directories.
Click to hide internal directories.