Versions in this module Expand all Collapse all v2 v2.2.1 Apr 25, 2024 v2.2.0 Mar 31, 2024 v2.1.6 Feb 5, 2024 v2.1.5 Dec 10, 2023 v2.1.4 Nov 27, 2023 v2.1.3 Oct 6, 2023 v2.1.2 Sep 20, 2023 Changes in this version type FieldInfo + DBType string + type ModelCache struct + func NewModelCacheHandler() *ModelCache + func (mc *ModelCache) All() map[string]*ModelInfo + func (mc *ModelCache) AllOrdered() []*ModelInfo + func (mc *ModelCache) Bootstrap() + func (mc *ModelCache) Clean() + func (mc *ModelCache) Empty() bool + func (mc *ModelCache) Get(table string) (mi *ModelInfo, ok bool) + func (mc *ModelCache) GetByFullName(name string) (mi *ModelInfo, ok bool) + func (mc *ModelCache) GetByMd(md interface{}) (*ModelInfo, bool) + func (mc *ModelCache) Register(prefixOrSuffixStr string, prefixOrSuffix bool, models ...interface{}) (err error) + func (mc *ModelCache) Set(table string, mi *ModelInfo) *ModelInfo v2.1.1 Jul 31, 2023 Changes in this version + const IsFieldType + const IsIntegerField + const IsPositiveIntegerField + const IsRelField + const OdCascade + const OdDoNothing + const OdSetDefault + const OdSetNULL + const RelForeignKey + const RelManyToMany + const RelOneToOne + const RelReverseMany + const RelReverseOne + const TypeBigIntegerField + const TypeBitField + const TypeBooleanField + const TypeCharField + const TypeDateField + const TypeDateTimeField + const TypeDecimalField + const TypeFloatField + const TypeIntegerField + const TypeJSONField + const TypeJsonbField + const TypePositiveBigIntegerField + const TypePositiveBitField + const TypePositiveIntegerField + const TypePositiveSmallIntegerField + const TypeSmallIntegerField + const TypeTextField + const TypeTimeField + const TypeVarCharField + var DefaultNameStrategy = "snakeString" + var DefaultStructTagName = "orm" + var NameStrategy = DefaultNameStrategy + var NameStrategyMap = map[string]fn + var SnakeAcronymNameStrategy = "snakeStringWithAcronym" + func AddModelFields(mi *ModelInfo, ind reflect.Value, mName string, index []int) + func CamelString(s string) string + func GetFullName(typ reflect.Type) string + func GetTableEngine(val reflect.Value) string + func GetTableIndex(val reflect.Value) [][]string + func GetTableName(val reflect.Value) string + func GetTableUnique(val reflect.Value) [][]string + func IsApplicableTableForDB(val reflect.Value, db string) bool + func ParseStructTag(data string) (attrs map[string]bool, tags map[string]string) + func SnakeString(s string) string + func SnakeStringWithAcronym(s string) string + type BigIntegerField int64 + func (e *BigIntegerField) FieldType() int + func (e *BigIntegerField) RawValue() interface{} + func (e *BigIntegerField) Set(d int64) + func (e *BigIntegerField) SetRaw(value interface{}) error + func (e *BigIntegerField) String() string + func (e BigIntegerField) Value() int64 + type BooleanField bool + func (e *BooleanField) FieldType() int + func (e *BooleanField) RawValue() interface{} + func (e *BooleanField) Set(d bool) + func (e *BooleanField) SetRaw(value interface{}) error + func (e *BooleanField) String() string + func (e BooleanField) Value() bool + type CharField string + func (e *CharField) FieldType() int + func (e *CharField) RawValue() interface{} + func (e *CharField) Set(d string) + func (e *CharField) SetRaw(value interface{}) error + func (e *CharField) String() string + func (e CharField) Value() string + type DateField time.Time + func (e *DateField) FieldType() int + func (e *DateField) RawValue() interface{} + func (e *DateField) Set(d time.Time) + func (e *DateField) SetRaw(value interface{}) error + func (e *DateField) String() string + func (e DateField) Value() time.Time + type DateTimeField time.Time + func (e *DateTimeField) FieldType() int + func (e *DateTimeField) RawValue() interface{} + func (e *DateTimeField) Set(d time.Time) + func (e *DateTimeField) SetRaw(value interface{}) error + func (e *DateTimeField) String() string + func (e DateTimeField) Value() time.Time + type FieldInfo struct + AddrValue reflect.Value + Auto bool + AutoNow bool + AutoNowAdd bool + ColDefault bool + Column string + DBcol bool + Decimals int + Description string + Digits int + FieldIndex []int + FieldType int + FullName string + InModel bool + Index bool + Initial utils.StrTo + IsFielder bool + Mi *ModelInfo + Name string + Null bool + OnDelete string + Pk bool + Rel bool + RelModelInfo *ModelInfo + RelTable string + RelThrough string + RelThroughModelInfo *ModelInfo + Reverse bool + ReverseField string + ReverseFieldInfo *FieldInfo + ReverseFieldInfoM2M *FieldInfo + ReverseFieldInfoTwo *FieldInfo + Sf reflect.StructField + Size int + TimePrecision *int + ToText bool + Unique bool + func NewFieldInfo(mi *ModelInfo, field reflect.Value, sf reflect.StructField, mName string) (fi *FieldInfo, err error) + type Fielder interface + FieldType func() int + RawValue func() interface{} + SetRaw func(interface{}) error + String func() string + type Fields struct + Columns map[string]*FieldInfo + DBcols []string + Fields map[string]*FieldInfo + FieldsByType map[int][]*FieldInfo + FieldsDB []*FieldInfo + FieldsLow map[string]*FieldInfo + FieldsRel []*FieldInfo + FieldsReverse []*FieldInfo + Orders []string + Pk *FieldInfo + Rels []*FieldInfo + func NewFields() *Fields + func (f *Fields) Add(fi *FieldInfo) (added bool) + func (f *Fields) GetByAny(name string) (*FieldInfo, bool) + func (f *Fields) GetByColumn(column string) *FieldInfo + func (f *Fields) GetByName(name string) *FieldInfo + type FloatField float64 + func (e *FloatField) FieldType() int + func (e *FloatField) RawValue() interface{} + func (e *FloatField) Set(d float64) + func (e *FloatField) SetRaw(value interface{}) error + func (e *FloatField) String() string + func (e FloatField) Value() float64 + type IntegerField int32 + func (e *IntegerField) FieldType() int + func (e *IntegerField) RawValue() interface{} + func (e *IntegerField) Set(d int32) + func (e *IntegerField) SetRaw(value interface{}) error + func (e *IntegerField) String() string + func (e IntegerField) Value() int32 + type JSONField string + func (j *JSONField) FieldType() int + func (j *JSONField) RawValue() interface{} + func (j *JSONField) Set(d string) + func (j *JSONField) SetRaw(value interface{}) error + func (j *JSONField) String() string + func (j JSONField) Value() string + type JsonbField string + func (j *JsonbField) FieldType() int + func (j *JsonbField) RawValue() interface{} + func (j *JsonbField) Set(d string) + func (j *JsonbField) SetRaw(value interface{}) error + func (j *JsonbField) String() string + func (j JsonbField) Value() string + type ModelInfo struct + AddrField reflect.Value + Fields *Fields + FullName string + IsThrough bool + Manual bool + Model interface{} + Name string + Pkg string + Table string + Uniques []string + func NewM2MModelInfo(m1, m2 *ModelInfo) (mi *ModelInfo) + func NewModelInfo(val reflect.Value) (mi *ModelInfo) + type PositiveBigIntegerField uint64 + func (e *PositiveBigIntegerField) FieldType() int + func (e *PositiveBigIntegerField) RawValue() interface{} + func (e *PositiveBigIntegerField) Set(d uint64) + func (e *PositiveBigIntegerField) SetRaw(value interface{}) error + func (e *PositiveBigIntegerField) String() string + func (e PositiveBigIntegerField) Value() uint64 + type PositiveIntegerField uint32 + func (e *PositiveIntegerField) FieldType() int + func (e *PositiveIntegerField) RawValue() interface{} + func (e *PositiveIntegerField) Set(d uint32) + func (e *PositiveIntegerField) SetRaw(value interface{}) error + func (e *PositiveIntegerField) String() string + func (e PositiveIntegerField) Value() uint32 + type PositiveSmallIntegerField uint16 + func (e *PositiveSmallIntegerField) FieldType() int + func (e *PositiveSmallIntegerField) RawValue() interface{} + func (e *PositiveSmallIntegerField) Set(d uint16) + func (e *PositiveSmallIntegerField) SetRaw(value interface{}) error + func (e *PositiveSmallIntegerField) String() string + func (e PositiveSmallIntegerField) Value() uint16 + type SmallIntegerField int16 + func (e *SmallIntegerField) FieldType() int + func (e *SmallIntegerField) RawValue() interface{} + func (e *SmallIntegerField) Set(d int16) + func (e *SmallIntegerField) SetRaw(value interface{}) error + func (e *SmallIntegerField) String() string + func (e SmallIntegerField) Value() int16 + type TextField string + func (e *TextField) FieldType() int + func (e *TextField) RawValue() interface{} + func (e *TextField) Set(d string) + func (e *TextField) SetRaw(value interface{}) error + func (e *TextField) String() string + func (e TextField) Value() string + type TimeField time.Time + func (e *TimeField) FieldType() int + func (e *TimeField) RawValue() interface{} + func (e *TimeField) Set(d time.Time) + func (e *TimeField) SetRaw(value interface{}) error + func (e *TimeField) String() string + func (e TimeField) Value() time.Time