Documentation ¶
Index ¶
- func GetContext[TDbContext IDbContext](dbName string) *TDbContext
- func InitContext[TDbContext IDbContext](repositoryContext *TDbContext, dbName string)
- func NewContext[TDbContext IDbContext](dbName string) *TDbContext
- func RegisterContext[TDbContext IDbContext](dbName string, autoCreateTable bool)
- func RegisterInternalContext(key string, configString string)
- func ToMap(entity any) map[string]any
- type DataDriver
- type DefaultRepository
- func (receiver *DefaultRepository[TPoType, TDomainObject]) Add(entity TDomainObject) error
- func (receiver *DefaultRepository[TPoType, TDomainObject]) AddIgnore(entity TDomainObject) error
- func (receiver *DefaultRepository[TPoType, TDomainObject]) AddIgnoreList(lst collections.List[TDomainObject], batchSize int) (int64, error)
- func (receiver *DefaultRepository[TPoType, TDomainObject]) AddList(lst collections.List[TDomainObject], batchSize int) (int64, error)
- func (receiver *DefaultRepository[TPoType, TDomainObject]) Count() int64
- func (receiver *DefaultRepository[TPoType, TDomainObject]) Delete(id any) (int64, error)
- func (receiver *DefaultRepository[TPoType, TDomainObject]) IsExists(id any) bool
- func (receiver *DefaultRepository[TPoType, TDomainObject]) ToEntity(id any) TDomainObject
- func (receiver *DefaultRepository[TPoType, TDomainObject]) ToList() collections.List[TDomainObject]
- func (receiver *DefaultRepository[TPoType, TDomainObject]) ToPageList(pageSize, pageIndex int) collections.PageList[TDomainObject]
- func (receiver *DefaultRepository[TPoType, TDomainObject]) Update(id any, do TDomainObject) (int64, error)
- type DomainSet
- type FinalHint
- type IDataDriver
- type IDbContext
- type IGetInternalContext
- type IInternalContext
- type IMigratorCreate
- type IMigratorIndex
- type IRepository
- type IdxField
- type Module
- type TableSet
- func (receiver *TableSet[Table]) Asc(fieldName string) *TableSet[Table]
- func (receiver *TableSet[Table]) AscIf(conditional bool, fieldName string) *TableSet[Table]
- func (receiver *TableSet[Table]) AscIfElse(conditional bool, trueFieldName string, falseFieldName string) *TableSet[Table]
- func (receiver *TableSet[Table]) Clickhouse() *mergeTreeSet
- func (receiver *TableSet[Table]) Count() int64
- func (receiver *TableSet[Table]) CreateIndex()
- func (receiver *TableSet[Table]) CreateTable(engine string)
- func (receiver *TableSet[Table]) Delete() (int64, error)
- func (receiver *TableSet[Table]) Desc(fieldName string) *TableSet[Table]
- func (receiver *TableSet[Table]) DescIf(conditional bool, fieldName string) *TableSet[Table]
- func (receiver *TableSet[Table]) DescIfElse(conditional bool, trueFieldName string, falseFieldName string) *TableSet[Table]
- func (receiver *TableSet[Table]) ExecuteSql(sql string, values ...any) (int64, error)
- func (receiver *TableSet[Table]) ExecuteSqlToArray(sql string, values ...any) []Table
- func (receiver *TableSet[Table]) ExecuteSqlToEntity(sql string, values ...any) Table
- func (receiver *TableSet[Table]) ExecuteSqlToList(sql string, values ...any) collections.List[Table]
- func (receiver *TableSet[Table]) Expr(field string, expr string, args ...any) (int64, error)
- func (receiver *TableSet[Table]) Exprs(fields map[string][]any) (int64, error)
- func (receiver *TableSet[Table]) Fill(dest any, conds ...any)
- func (receiver *TableSet[Table]) Final() *TableSet[Table]
- func (receiver *TableSet[Table]) ForceIndex(idxName string) *TableSet[Table]
- func (receiver *TableSet[Table]) GetBool(fieldName string) bool
- func (receiver *TableSet[Table]) GetBools(fieldName string) collections.List[bool]
- func (receiver *TableSet[Table]) GetDecimal(fieldName string) decimal.Decimal
- func (receiver *TableSet[Table]) GetDecimals(fieldName string) collections.List[decimal.Decimal]
- func (receiver *TableSet[Table]) GetFloat32(fieldName string) float32
- func (receiver *TableSet[Table]) GetFloat32s(fieldName string) collections.List[float32]
- func (receiver *TableSet[Table]) GetFloat64(fieldName string) float64
- func (receiver *TableSet[Table]) GetFloat64s(fieldName string) collections.List[float64]
- func (receiver *TableSet[Table]) GetInt(fieldName string) int
- func (receiver *TableSet[Table]) GetInts(fieldName string) collections.List[int]
- func (receiver *TableSet[Table]) GetLong(fieldName string) int64
- func (receiver *TableSet[Table]) GetLongs(fieldName string) collections.List[int64]
- func (receiver *TableSet[Table]) GetPrimaryName()
- func (receiver *TableSet[Table]) GetString(fieldName string) string
- func (receiver *TableSet[Table]) GetStrings(fieldName string) collections.List[string]
- func (receiver *TableSet[Table]) GetTableName() string
- func (receiver *TableSet[Table]) GetTime(fieldName string) time.Time
- func (receiver *TableSet[Table]) GetTimes(fieldName string) collections.List[time.Time]
- func (receiver *TableSet[Table]) Init(dbContext *internalContext, param map[string]string)
- func (receiver *TableSet[Table]) Insert(po *Table) error
- func (receiver *TableSet[Table]) InsertIgnore(po *Table) error
- func (receiver *TableSet[Table]) InsertIgnoreList(lst collections.List[Table], batchSize int) (int64, error)
- func (receiver *TableSet[Table]) InsertList(lst collections.List[Table], batchSize int) (int64, error)
- func (receiver *TableSet[Table]) IsExists() bool
- func (receiver *TableSet[Table]) Limit(limit int) *TableSet[Table]
- func (receiver *TableSet[Table]) Omit(columns ...string) *TableSet[Table]
- func (receiver *TableSet[Table]) Order(value any) *TableSet[Table]
- func (receiver *TableSet[Table]) OrderIf(conditional bool, value any) *TableSet[Table]
- func (receiver *TableSet[Table]) Original() *gorm.DB
- func (receiver *TableSet[Table]) Select(query any, args ...any) *TableSet[Table]
- func (receiver *TableSet[Table]) SetTableName(tableName string) *TableSet[Table]
- func (receiver *TableSet[Table]) ToArray() []Table
- func (receiver *TableSet[Table]) ToEntity() Table
- func (receiver *TableSet[Table]) ToList() collections.List[Table]
- func (receiver *TableSet[Table]) ToPageList(pageSize int, pageIndex int) collections.PageList[Table]
- func (receiver *TableSet[Table]) TruncateTable() error
- func (receiver *TableSet[Table]) Update(po Table) (int64, error)
- func (receiver *TableSet[Table]) UpdateOrInsert(po Table, fields ...string) error
- func (receiver *TableSet[Table]) UpdateOrInsertByPrimary(po Table) error
- func (receiver *TableSet[Table]) UpdateValue(column string, value any) (int64, error)
- func (receiver *TableSet[Table]) UseIndex(idxName string) *TableSet[Table]
- func (receiver *TableSet[Table]) Where(query any, args ...any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereBetween(columnName any, min, max any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereBetweenIf(conditional bool, columnName any, min, max any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereEq(columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereEqIf(conditional bool, columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereFindInSet(fieldName string, fieldValue string) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereFindInSetOrEq(fieldName, fieldValue, orFieldName string, orFieldValue any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereGt(columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereGtIf(conditional bool, columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereGte(columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereGteIf(conditional bool, columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereIf(conditional bool, query any, args ...any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereIgnoreLessZero(query any, val int) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereIgnoreNil(query any, val any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereIn(columnName any, args ...any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereInIf(conditional bool, columnName any, args ...any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereLike(columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereLikeIf(conditional bool, columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereLt(columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereLtIf(conditional bool, columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereLte(columnName any, args any) *TableSet[Table]
- func (receiver *TableSet[Table]) WhereLteIf(conditional bool, columnName any, args any) *TableSet[Table]
- type TracePlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContext ¶ added in v0.8.0
func GetContext[TDbContext IDbContext](dbName string) *TDbContext
GetContext 获取上下文实例(每次获取都会创建一个实例)
func InitContext ¶
func InitContext[TDbContext IDbContext](repositoryContext *TDbContext, dbName string)
InitContext 数据库上下文初始化 keyName:数据库配置名称 autoCreateTable:true表示自动创建表 同一个上下文生命周期内,共享一个orm client
func NewContext ¶
func NewContext[TDbContext IDbContext](dbName string) *TDbContext
NewContext 数据库上下文初始化 keyName:数据库配置名称,对应./farseer.yaml 中的 Database节点 autoCreateTable:true表示自动创建表 同一个上下文生命周期内,共享一个orm client
func RegisterContext ¶ added in v0.8.0
func RegisterContext[TDbContext IDbContext](dbName string, autoCreateTable bool)
RegisterContext 注册上下文(临时生命周期)
func RegisterInternalContext ¶ added in v0.9.0
RegisterInternalContext 注册内部上下文 DataType=mysql,PoolMaxSize=50,PoolMinSize=1,ConnectionString=user:pass@tcp(127.0.0.1:3306)/dbname?charset=utf8mb4&parseTime=True&loc=Local DataType=sqlserver,PoolMaxSize=50,PoolMinSize=1,ConnectionString=sqlserver://user:123456@127.0.0.1:9930?database=dbname DataType=clickhouse,PoolMaxSize=50,PoolMinSize=1,ConnectionString=tcp://192.168.1.8:9000?database=dbname&username=default&password=&read_timeout=10&write_timeout=20 DataType=postgresql,PoolMaxSize=50,PoolMinSize=1,ConnectionString=host=127.0.0.1 user=user password=123456 dbname=dbname port=9920 sslmode=disable TimeZone=Asia/Shanghai DataType=sqlite,PoolMaxSize=50,PoolMinSize=1,ConnectionString=gorm.db
Types ¶
type DataDriver ¶ added in v0.13.0
type DataDriver struct { }
func (*DataDriver) CreateIndex ¶ added in v0.13.0
func (receiver *DataDriver) CreateIndex(tableName string, idxName string, idxField IdxField) string
type DefaultRepository ¶ added in v0.8.0
type DefaultRepository[TPoType any, TDomainObject any] struct { // contains filtered or unexported fields }
func (*DefaultRepository[TPoType, TDomainObject]) Add ¶ added in v0.8.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) Add(entity TDomainObject) error
func (*DefaultRepository[TPoType, TDomainObject]) AddIgnore ¶ added in v0.15.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) AddIgnore(entity TDomainObject) error
func (*DefaultRepository[TPoType, TDomainObject]) AddIgnoreList ¶ added in v0.14.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) AddIgnoreList(lst collections.List[TDomainObject], batchSize int) (int64, error)
func (*DefaultRepository[TPoType, TDomainObject]) AddList ¶ added in v0.14.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) AddList(lst collections.List[TDomainObject], batchSize int) (int64, error)
func (*DefaultRepository[TPoType, TDomainObject]) Count ¶ added in v0.8.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) Count() int64
func (*DefaultRepository[TPoType, TDomainObject]) Delete ¶ added in v0.9.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) Delete(id any) (int64, error)
func (*DefaultRepository[TPoType, TDomainObject]) IsExists ¶ added in v0.9.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) IsExists(id any) bool
func (*DefaultRepository[TPoType, TDomainObject]) ToEntity ¶ added in v0.8.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) ToEntity(id any) TDomainObject
func (*DefaultRepository[TPoType, TDomainObject]) ToList ¶ added in v0.8.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) ToList() collections.List[TDomainObject]
func (*DefaultRepository[TPoType, TDomainObject]) ToPageList ¶ added in v0.8.0
func (receiver *DefaultRepository[TPoType, TDomainObject]) ToPageList(pageSize, pageIndex int) collections.PageList[TDomainObject]
type FinalHint ¶ added in v0.15.0
type FinalHint struct { }
func (FinalHint) ModifyStatement ¶ added in v0.15.0
type IDataDriver ¶ added in v0.11.0
type IGetInternalContext ¶ added in v0.14.0
type IGetInternalContext interface {
GetInternalContext() IInternalContext
}
type IInternalContext ¶ added in v0.8.0
type IInternalContext interface { core.ITransaction Original() *gorm.DB // ExecuteSql 执行自定义SQL ExecuteSql(sql string, values ...any) (int64, error) // ExecuteSqlToResult 返回结果(执行自定义SQL) ExecuteSqlToResult(arrayOrEntity any, sql string, values ...any) (int64, error) // ExecuteSqlToValue 返回单个字段值(执行自定义SQL) ExecuteSqlToValue(field any, sql string, values ...any) (int64, error) }
type IMigratorCreate ¶ added in v0.9.0
type IMigratorCreate interface { // CreateTable 创建表 CreateTable() string }
type IMigratorIndex ¶ added in v0.13.0
type IRepository ¶ added in v0.8.0
type IRepository[TDomainObject any] interface { // ToEntity 查询实体 ToEntity(id any) TDomainObject // Add 添加实体 Add(entity TDomainObject) error // AddIgnore 添加实体(忽略主键存在的记录) AddIgnore(entity TDomainObject) error // AddList 批量添加 AddList(lst collections.List[TDomainObject], batchSize int) (int64, error) // AddIgnoreList 批量添加(忽略主键存在的记录) AddIgnoreList(lst collections.List[TDomainObject], batchSize int) (int64, error) // ToList 获取所有列表 ToList() collections.List[TDomainObject] // ToPageList 分页列表 ToPageList(pageSize, pageIndex int) collections.PageList[TDomainObject] // Count 数量 Count() int64 // Update 保存数据 Update(id any, do TDomainObject) (int64, error) // Delete 删除数据 Delete(id any) (int64, error) // IsExists 记录是否存在 IsExists(id any) bool }
IRepository 通用的仓储接口,实现常用的CURD
func NewDefaultRepository ¶ added in v0.8.0
func NewDefaultRepository[TPoType any, TDomainObject any](table TableSet[TPoType], getInternalContext IGetInternalContext) IRepository[TDomainObject]
type Module ¶
type Module struct { }
func (Module) DependsModule ¶
func (module Module) DependsModule() []modules.FarseerModule
func (Module) Initialize ¶
func (module Module) Initialize()
func (Module) PreInitialize ¶
func (module Module) PreInitialize()
type TableSet ¶
type TableSet[Table any] struct { // contains filtered or unexported fields }
TableSet 数据库表操作
func (*TableSet[Table]) AscIfElse ¶ added in v0.12.0
func (receiver *TableSet[Table]) AscIfElse(conditional bool, trueFieldName string, falseFieldName string) *TableSet[Table]
AscIfElse 正序,当conditional==true时,使用trueFieldName正序,否则使用falseFieldName正序
func (*TableSet[Table]) Clickhouse ¶ added in v0.9.0
func (receiver *TableSet[Table]) Clickhouse() *mergeTreeSet
Clickhouse 返回Clickhouse的对象
func (*TableSet[Table]) CreateIndex ¶ added in v0.13.0
func (receiver *TableSet[Table]) CreateIndex()
func (*TableSet[Table]) CreateTable ¶ added in v0.2.0
CreateTable 创建表(如果不存在) 相关链接:https://gorm.io/zh_CN/docs/migration.html 相关链接:https://gorm.io/zh_CN/docs/indexes.html
func (*TableSet[Table]) DescIfElse ¶ added in v0.12.0
func (receiver *TableSet[Table]) DescIfElse(conditional bool, trueFieldName string, falseFieldName string) *TableSet[Table]
DescIfElse 倒序,当conditional==true时,使用trueFieldName倒序,否则使用falseFieldName倒序
func (*TableSet[Table]) ExecuteSql ¶ added in v0.8.0
ExecuteSql 执行自定义SQL
func (*TableSet[Table]) ExecuteSqlToArray ¶ added in v0.8.0
ExecuteSqlToArray 返回结果集(执行自定义SQL)
func (*TableSet[Table]) ExecuteSqlToEntity ¶ added in v0.8.0
ExecuteSqlToEntity 返回单个对象(执行自定义SQL)
func (*TableSet[Table]) ExecuteSqlToList ¶ added in v0.8.0
func (receiver *TableSet[Table]) ExecuteSqlToList(sql string, values ...any) collections.List[Table]
ExecuteSqlToList 返回结果集(执行自定义SQL)
func (*TableSet[Table]) Expr ¶ added in v0.8.0
Expr 对字段做表达式操作
exp: Expr("price", "price * ? + ?", 2, 100) sql: UPDATE "xxx" SET price = price * 2 + 100
func (*TableSet[Table]) Exprs ¶ added in v0.9.0
Exprs 对多个字段做表达式操作
exp: Exprs(map[string][]any{"price": {"price - ?", 10}, "count": {"count + ?", 5}}) sql: UPDATE "xxx" SET price = price - 10, count = count + 5
func (*TableSet[Table]) ForceIndex ¶ added in v0.15.0
ForceIndex 强制使用索引
func (*TableSet[Table]) GetBools ¶ added in v0.14.0
func (receiver *TableSet[Table]) GetBools(fieldName string) collections.List[bool]
GetBools 获取bool字段的集合
func (*TableSet[Table]) GetDecimal ¶ added in v0.9.0
GetDecimal 获取单条记录中的单个decimal.Decimal类型字段值
func (*TableSet[Table]) GetDecimals ¶ added in v0.14.0
GetDecimals 获取decimal.Decimal字段的集合
func (*TableSet[Table]) GetFloat32 ¶
GetFloat32 获取单条记录中的单个float32类型字段值
func (*TableSet[Table]) GetFloat32s ¶ added in v0.14.0
func (receiver *TableSet[Table]) GetFloat32s(fieldName string) collections.List[float32]
GetFloat32s 获取float32字段的集合
func (*TableSet[Table]) GetFloat64 ¶
GetFloat64 获取单条记录中的单个float64类型字段值
func (*TableSet[Table]) GetFloat64s ¶ added in v0.14.0
func (receiver *TableSet[Table]) GetFloat64s(fieldName string) collections.List[float64]
GetFloat64s 获取float64字段的集合
func (*TableSet[Table]) GetInts ¶ added in v0.14.0
func (receiver *TableSet[Table]) GetInts(fieldName string) collections.List[int]
GetInts 获取int字段的集合
func (*TableSet[Table]) GetLongs ¶ added in v0.14.0
func (receiver *TableSet[Table]) GetLongs(fieldName string) collections.List[int64]
GetLongs 获取long字段的集合
func (*TableSet[Table]) GetPrimaryName ¶ added in v0.8.0
func (receiver *TableSet[Table]) GetPrimaryName()
GetPrimaryName 获取主键
func (*TableSet[Table]) GetStrings ¶ added in v0.14.0
func (receiver *TableSet[Table]) GetStrings(fieldName string) collections.List[string]
GetStrings 获取string字段的集合
func (*TableSet[Table]) GetTableName ¶
GetTableName 获取表名称
func (*TableSet[Table]) InsertIgnore ¶ added in v0.14.0
InsertIgnore 新增记录(忽略主键、唯一键存在的记录)
func (*TableSet[Table]) InsertIgnoreList ¶ added in v0.14.0
func (receiver *TableSet[Table]) InsertIgnoreList(lst collections.List[Table], batchSize int) (int64, error)
InsertIgnoreList 批量新增记录(忽略主键、唯一键存在的记录)
func (*TableSet[Table]) InsertList ¶ added in v0.2.0
func (receiver *TableSet[Table]) InsertList(lst collections.List[Table], batchSize int) (int64, error)
InsertList 批量新增记录
func (*TableSet[Table]) SetTableName ¶
SetTableName 设置表名
func (*TableSet[Table]) ToEntity ¶
func (receiver *TableSet[Table]) ToEntity() Table
ToEntity 返回单个对象
func (*TableSet[Table]) ToList ¶
func (receiver *TableSet[Table]) ToList() collections.List[Table]
ToList 返回结果集
func (*TableSet[Table]) ToPageList ¶
func (receiver *TableSet[Table]) ToPageList(pageSize int, pageIndex int) collections.PageList[Table]
ToPageList 返回分页结果集
func (*TableSet[Table]) TruncateTable ¶ added in v0.14.0
func (*TableSet[Table]) UpdateOrInsert ¶ added in v0.2.0
UpdateOrInsert 记录存在时(根据Fields判断)更新,不存在时插入 fields:唯一键 或 主键,即由哪些字段组成的条件为存在或不存在判定
func (*TableSet[Table]) UpdateOrInsertByPrimary ¶ added in v0.15.0
UpdateOrInsertByPrimary 记录存在时(根据主键判断)更新,不存在时插入
func (*TableSet[Table]) UpdateValue ¶
UpdateValue 修改单个字段
func (*TableSet[Table]) WhereBetween ¶ added in v0.12.0
func (*TableSet[Table]) WhereBetweenIf ¶ added in v0.12.0
func (receiver *TableSet[Table]) WhereBetweenIf(conditional bool, columnName any, min, max any) *TableSet[Table]
WhereBetweenIf 当conditional==true时,使用between条件(>=and<=)
func (*TableSet[Table]) WhereEqIf ¶ added in v0.12.0
func (receiver *TableSet[Table]) WhereEqIf(conditional bool, columnName any, args any) *TableSet[Table]
WhereEqIf 当conditional==true时,使用等于条件
func (*TableSet[Table]) WhereFindInSet ¶ added in v0.15.0
func (receiver *TableSet[Table]) WhereFindInSet(fieldName string, fieldValue string) *TableSet[Table]
WhereFindInSet FIND_IN_SET条件 FIND_IN_SET (fieldValue,fieldName)
func (*TableSet[Table]) WhereFindInSetOrEq ¶ added in v0.15.0
func (receiver *TableSet[Table]) WhereFindInSetOrEq(fieldName, fieldValue, orFieldName string, orFieldValue any) *TableSet[Table]
WhereFindInSetOrEq FIND_IN_SET条件 FIND_IN_SET (fieldValue,fieldName) or orFieldName = orFieldValue
func (*TableSet[Table]) WhereGtIf ¶ added in v0.12.0
func (receiver *TableSet[Table]) WhereGtIf(conditional bool, columnName any, args any) *TableSet[Table]
WhereGtIf 当conditional==true时,使用大于条件
func (*TableSet[Table]) WhereGteIf ¶ added in v0.12.0
func (receiver *TableSet[Table]) WhereGteIf(conditional bool, columnName any, args any) *TableSet[Table]
WhereGteIf 当conditional==true时,使用大于等于条件
func (*TableSet[Table]) WhereIgnoreLessZero ¶ added in v0.8.0
WhereIgnoreLessZero 条件,自动忽略小于等于0的
func (*TableSet[Table]) WhereIgnoreNil ¶ added in v0.8.0
WhereIgnoreNil 条件,自动忽略nil条件
func (*TableSet[Table]) WhereInIf ¶ added in v0.12.0
func (receiver *TableSet[Table]) WhereInIf(conditional bool, columnName any, args ...any) *TableSet[Table]
WhereInIf 当conditional==true时,使用in条件
func (*TableSet[Table]) WhereLikeIf ¶ added in v0.12.0
func (receiver *TableSet[Table]) WhereLikeIf(conditional bool, columnName any, args any) *TableSet[Table]
WhereLikeIf 当conditional==true时,使用like条件("%?%"匹配)
func (*TableSet[Table]) WhereLtIf ¶ added in v0.12.0
func (receiver *TableSet[Table]) WhereLtIf(conditional bool, columnName any, args any) *TableSet[Table]
WhereLtIf 当conditional==true时,使用小于条件
type TracePlugin ¶ added in v0.9.0
type TracePlugin struct {
// contains filtered or unexported fields
}
func (*TracePlugin) Initialize ¶ added in v0.9.0
func (op *TracePlugin) Initialize(db *gorm.DB) (err error)
func (*TracePlugin) Name ¶ added in v0.9.0
func (op *TracePlugin) Name() string