Documentation ¶
Index ¶
- Constants
- Variables
- func GormConvertString(db *gorm.DB, neq bool, field string, values ...string) *gorm.DB
- func NewLogger(config glog.Config) glog.Interface
- func OpenPool(ctx context.Context, uu string) (storage.Storage, error)
- func QuoteTo(db *gorm.DB, s string) string
- func TableNameFromModel(db *gorm.DB, model any) string
- type Abstract
- type AbstractResources
- type BoolInt
- type Dialector
- type EnumSerial
- type Helper
- type ILike
- type OrderedUpdate
- type Resources
Constants ¶
View Source
const ( SqliteDriver = "sqlite" )
View Source
const (
MySQLDriver = "mysql"
)
View Source
const (
PostgreDriver = "postgres"
)
Variables ¶
View Source
var ( DefaultConnectionTimeout = 30 * time.Second LongConnectionTimeout = 10 * time.Minute )
View Source
var (
Drivers = []string{MySQLDriver, PostgreDriver, SqliteDriver}
)
View Source
var (
TestPrintQueries = false
)
Functions ¶
func GormConvertString ¶
GormConvertString creates correct gorm.Queries for field + string value
Types ¶
type Abstract ¶
func NewAbstract ¶
NewAbstract initializes a new Abstract to be used by DAO implementation
func (*Abstract) MigrateWithCtx ¶
MigrateWithCtx triggers AutoMigrate in context
func (*Abstract) Session ¶
Session creates a gorm session with given context and default config (SkipDefaultTransaction: true)
func (*Abstract) WithModels ¶
WithModels sets the migrateModels factory for auto migration
type AbstractResources ¶
func NewAbstractResources ¶
func NewAbstractResources(db *gorm.DB) *AbstractResources
func (*AbstractResources) WithModels ¶
func (a *AbstractResources) WithModels(factory func() []any) *AbstractResources
type BoolInt ¶
type BoolInt struct{}
BoolInt is a gorm serializer to store booleans as integers
type EnumSerial ¶
type EnumSerial struct{}
EnumSerial is a gorm serializer to store proto.Enum as string instead of integer
type Helper ¶
type Helper interface { Concat(...string) string Hash(...string) string ParentMPath(levelKey string, mpathes ...string) string HashParent(nameKey string, levelKey string, mpathes ...string) string ApplyOrderedUpdates(db *gorm.DB, tableName string, sets []OrderedUpdate, wheres []sql.NamedArg) (int64, error) MPathOrdering(...string) string FirstAvailableSlot(tableName string, mpath *tree.MPath, levelKey string, mpathes ...string) (string, []any, int64, bool) }
type OrderedUpdate ¶
type OrderedUpdate struct { Key string Value interface{} }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package index provides ready-to-use tables and DAOs for storing hierarchical data using the nested sets pattern
|
Package index provides ready-to-use tables and DAOs for storing hierarchical data using the nested sets pattern |
Package resources provides ready-to-use SQL schemes and DAOs for attaching resource policies to any data
|
Package resources provides ready-to-use SQL schemes and DAOs for attaching resource policies to any data |
Click to show internal directories.
Click to hide internal directories.