Documentation
¶
Index ¶
- Constants
- Variables
- func AnyToInt(v any) int
- func AnyToInt64(v any) int64
- func AnyToString(value any) string
- func AnyToTime(value any) time.Time
- func ConvertTo(value any, targetType reflect.Type) (any, error)
- func ParseUTCDateTime(value string) (time.Time, error)
- func StringValue(value *string) string
- type DAO
- type DBModel
- type ModelDAO
- type ModelDAOAttacher
- type ModelMetadata
- type ModelRecord
- func (m *ModelRecord[T]) AttachModelDAO(dao *ModelDAO[T], self T)
- func (m *ModelRecord[T]) Clean()
- func (m *ModelRecord[T]) Delete() int64
- func (m *ModelRecord[T]) Dirty(column string)
- func (m *ModelRecord[T]) FromAPI(apiData map[string]any) T
- func (m *ModelRecord[T]) GetID() int64
- func (m *ModelRecord[T]) GetModelMetadata() *ModelMetadata
- func (m *ModelRecord[T]) GetValue(columnName string) any
- func (m *ModelRecord[T]) Insert() int64
- func (m *ModelRecord[T]) InsertIgnore() int64
- func (m *ModelRecord[T]) IsClean() bool
- func (m *ModelRecord[T]) IsDirty() bool
- func (m *ModelRecord[T]) Load(id int64) T
- func (m *ModelRecord[T]) Save() int64
- func (m *ModelRecord[T]) SetID(id int64)
- func (m *ModelRecord[T]) SetValue(columnName string, value any) bool
- func (m *ModelRecord[T]) ToAPI() map[string]any
- func (m *ModelRecord[T]) ToWhere(query *bun.SelectQuery, args map[string]any) *bun.SelectQuery
- func (m *ModelRecord[T]) Update() int64
Constants ¶
View Source
const ( DialectMySQL = "mysql" DialectSQLite = "sqlite" DialectPostgreSQL = "pgsql" )
View Source
const ( MaxOpenConns = 25 MaxIdleConns = 25 MaxLifetime = 5 * time.Minute )
Variables ¶
View Source
var (
SQLDebug = false
)
Functions ¶
func AnyToInt64 ¶
func AnyToString ¶
func StringValue ¶
Types ¶
type DAO ¶
func OpenMySQLDBConnection ¶
func OpenPostgreSQLDBConnection ¶ added in v1.2.0
func OpenSQLiteDBConnection ¶
type ModelDAO ¶
func NewModelDAO ¶
func (*ModelDAO[T]) AttachList ¶
func (dao *ModelDAO[T]) AttachList(recordList []T)
type ModelDAOAttacher ¶
type ModelMetadata ¶
type ModelRecord ¶
type ModelRecord[T DBModel] struct { Dao *ModelDAO[T] Self T // contains filtered or unexported fields }
func (*ModelRecord[T]) AttachModelDAO ¶
func (m *ModelRecord[T]) AttachModelDAO(dao *ModelDAO[T], self T)
func (*ModelRecord[T]) Clean ¶
func (m *ModelRecord[T]) Clean()
func (*ModelRecord[T]) Delete ¶
func (m *ModelRecord[T]) Delete() int64
func (*ModelRecord[T]) Dirty ¶
func (m *ModelRecord[T]) Dirty(column string)
func (*ModelRecord[T]) FromAPI ¶
func (m *ModelRecord[T]) FromAPI(apiData map[string]any) T
func (*ModelRecord[T]) GetID ¶
func (m *ModelRecord[T]) GetID() int64
func (*ModelRecord[T]) GetModelMetadata ¶
func (m *ModelRecord[T]) GetModelMetadata() *ModelMetadata
func (*ModelRecord[T]) GetValue ¶
func (m *ModelRecord[T]) GetValue(columnName string) any
func (*ModelRecord[T]) Insert ¶
func (m *ModelRecord[T]) Insert() int64
func (*ModelRecord[T]) InsertIgnore ¶
func (m *ModelRecord[T]) InsertIgnore() int64
func (*ModelRecord[T]) IsClean ¶
func (m *ModelRecord[T]) IsClean() bool
func (*ModelRecord[T]) IsDirty ¶
func (m *ModelRecord[T]) IsDirty() bool
func (*ModelRecord[T]) Load ¶
func (m *ModelRecord[T]) Load(id int64) T
func (*ModelRecord[T]) Save ¶
func (m *ModelRecord[T]) Save() int64
func (*ModelRecord[T]) SetID ¶
func (m *ModelRecord[T]) SetID(id int64)
func (*ModelRecord[T]) SetValue ¶
func (m *ModelRecord[T]) SetValue(columnName string, value any) bool
func (*ModelRecord[T]) ToAPI ¶
func (m *ModelRecord[T]) ToAPI() map[string]any
func (*ModelRecord[T]) ToWhere ¶
func (m *ModelRecord[T]) ToWhere(query *bun.SelectQuery, args map[string]any) *bun.SelectQuery
func (*ModelRecord[T]) Update ¶
func (m *ModelRecord[T]) Update() int64
Click to show internal directories.
Click to hide internal directories.