Documentation
¶
Index ¶
- Constants
- Variables
- func Count[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (t int64, err error)
- func Delete[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (int64, error)
- func Exec(db Engine, query string, args ...any) (int64, error)
- func First[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (t *T, err error)
- func GetAutoIncrements(v reflect.Value) []string
- func GetOrInsert[T any](db Engine, wb *WhereBuilder, d *T, extra ...*ExtraContext) (*T, error)
- func GetPrimaryKeyNames(v reflect.Value) []string
- func GetTableName(v reflect.Value) *string
- func Has[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (t bool, err error)
- func Insert(db Engine, v any, extra ...*ExtraContext) (num int64, err error)
- func InsertOrHas(db Engine, wb *WhereBuilder, d any, extra ...*ExtraContext) (bool, error)
- func List[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (list []T, err error)
- func ListP[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (list []*T, err error)
- func QueryList[T any](db Engine, query string, args ...any) ([]T, error)
- func QueryListP[T any](db Engine, query string, args ...any) ([]*T, error)
- func QueryOne[T any](db Engine, query string, args ...any) (*T, error)
- func StmtQueryList[T any](db Stmter, args ...any) ([]T, error)
- func StmtQueryListP[T any](db Stmter, args ...any) ([]*T, error)
- func StmtQueryOne[T any](db Stmter, args ...any) (*T, error)
- func Update(db Engine, wb *WhereBuilder, dest any, extra ...*ExtraContext) (int64, error)
- type ArgArray
- type Clause
- type ColIndex2FieldNameMap
- type DbConfig
- type Dialecter
- type DuplicateKey
- type Engine
- type EngineBatch
- type ExtraContext
- func (e *ExtraContext) GetErr() error
- func (e *ExtraContext) Limit(num int64, condition ...bool) *ExtraContext
- func (e *ExtraContext) NoRun() *ExtraContext
- func (e *ExtraContext) Offset(num int64, condition ...bool) *ExtraContext
- func (e *ExtraContext) OrderBy(name string, condition ...bool) *ExtraContext
- func (e *ExtraContext) OrderDescBy(name string, condition ...bool) *ExtraContext
- func (e *ExtraContext) ReturnType(typ return_type.ReturnType) *ExtraContext
- func (e *ExtraContext) Select(name ...string) *ExtraContext
- func (e *ExtraContext) Set(name string, value any) *ExtraContext
- func (e *ExtraContext) SetExpression(name string, expression string) *ExtraContext
- func (e *ExtraContext) SetIncrement(name string, num any) *ExtraContext
- func (e *ExtraContext) SetNow(name string) *ExtraContext
- func (e *ExtraContext) SetNull(name string) *ExtraContext
- func (e *ExtraContext) ShowSql() *ExtraContext
- func (e *ExtraContext) SkipSoftDelete() *ExtraContext
- func (e *ExtraContext) TableName(name string) *ExtraContext
- func (e *ExtraContext) WhenDuplicateKey(name ...string) *DuplicateKey
- type Index
- type LdbTabler
- type Logger
- type MysqlConf
- type MysqlDialect
- type MysqlVersion
- type NativePrepare
- type NativeQuery
- type OrmConf
- type PackTyp
- type PageConfig
- type PageResult
- type PgConf
- type PgDialect
- type PoolConf
- type SetContext
- func (s *SetContext) Field(name ...string) *SetContext
- func (s *SetContext) Map(v map[string]any) *SetContext
- func (s *SetContext) Model(v any) *SetContext
- func (s *SetContext) Set(name string, value any) *SetContext
- func (s *SetContext) SetExpression(name string, expression string) *SetContext
- func (s *SetContext) SetIncrement(name string, num any) *SetContext
- func (s *SetContext) SetNull(name string) *SetContext
- type SqlBuilder
- func (b *SqlBuilder) AppendArg(arg any, conditions ...bool) *SqlBuilder
- func (b *SqlBuilder) AppendArgs(args ...any) *SqlBuilder
- func (b *SqlBuilder) AppendSql(sql string) *SqlBuilder
- func (b *SqlBuilder) Arg(arg any, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) Args(args ...any) *SqlBuilder
- func (b *SqlBuilder) Between(whereStr string, begin, end any, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) BetweenDateTimeOfDate(whereStr string, dateBegin, dateEnd *types.Date, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) BoolWhere(condition bool, whereStr string, args ...any) *SqlBuilder
- func (b *SqlBuilder) CountField(field string, conditions ...bool) *SqlBuilder
- func (b *SqlBuilder) Exec() (sql.Result, error)
- func (b *SqlBuilder) FakerTotalNum(num int64, conditions ...bool) *SqlBuilder
- func (b *SqlBuilder) From(name string) *SqlBuilder
- func (b *SqlBuilder) Join(name string, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) LeftJoin(name string, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) Limit(num int64, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) LinkWhere() *SqlBuilder
- func (b *SqlBuilder) Native(sql string, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) NoGetList(conditions ...bool) *SqlBuilder
- func (b *SqlBuilder) NoRun(conditions ...bool) *SqlBuilder
- func (b *SqlBuilder) Offset(num int64, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) OrderBy(name string, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) OrderDescBy(name string, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) Page(current int64, pageSize int64) *SqlBuilder
- func (b *SqlBuilder) RightJoin(name string, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) ScanList(dest any) (rowsNum int64, err error)
- func (b *SqlBuilder) ScanOne(dest any) (rowsNum int64, err error)
- func (b *SqlBuilder) ScanPage(dest any) (rowsNum int64, dto PageResult, err error)
- func (b *SqlBuilder) Select(arg string, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) SelectEnd() *SqlBuilder
- func (b *SqlBuilder) SelectModel(v any) *SqlBuilder
- func (b *SqlBuilder) ShowSql(conditions ...bool) *SqlBuilder
- func (b *SqlBuilder) Where(whereStr string, condition ...bool) *SqlBuilder
- func (b *SqlBuilder) WhereBuilder(w *WhereBuilder) *SqlBuilder
- func (b *SqlBuilder) WhereIn(whereStr string, args ...any) *SqlBuilder
- func (b *SqlBuilder) WhereSqlIn(whereStr string, args ...any) *SqlBuilder
- type Stmt
- type Stmter
- type StructValidFieldValueMap
- type TableConf
- type WhereBuilder
- func (w *WhereBuilder) And(wb *WhereBuilder, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Arg(arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Args(args ...any) *WhereBuilder
- func (w *WhereBuilder) Between(query string, arg1, arg2 any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Contains(query string, arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Eq(query string, arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) FilterPrimaryKey(v ...any) *WhereBuilder
- func (w *WhereBuilder) Greater(query string, arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) GreaterEq(query string, arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) In(query string, args ArgArray, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) IsFalse(query string, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) IsNotNull(query string, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) IsNull(query string, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Less(query string, arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) LessEq(query string, arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Like(query string, arg *string, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Map(v any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Model(v any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Neq(query string, arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) NoLike(query string, arg *string, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) NotBetween(query string, arg1, arg2 any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) NotEq(query string, arg any, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) NotIn(query string, args ArgArray, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) Or(wb *WhereBuilder, condition ...bool) *WhereBuilder
- func (w *WhereBuilder) PrimaryKey(v ...any) *WhereBuilder
Constants ¶
const ( Eq clauseType = iota Neq Less LessEq Greater GreaterEq Like NotLike In NotIn Between NotBetween IsNull IsNotNull IsFalse // Contains 包含 // pg 独有 // [1] @< [1,2] Contains )
const ( None packType = iota Ptr Slice )
const ( Invalid atomType = iota Atom Composite )
Variables ¶
var ( ErrNil = errors.New("nil") ErrContainEmpty = errors.New("slice empty") ErrNoPkOrUnique = errors.New(" ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification (SQLSTATE 42P10) ") )
var TableConfCache = map[reflect.Type]TableConf{}
Functions ¶
func Count ¶
func Count[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (t int64, err error)
Count
func Delete ¶
func Delete[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (int64, error)
func First ¶
func First[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (t *T, err error)
First 根据条件获取第一个
func GetAutoIncrements ¶
func GetOrInsert ¶
func GetOrInsert[T any](db Engine, wb *WhereBuilder, d *T, extra ...*ExtraContext) (*T, error)
GetOrInsert d insert 的 对象, e 通用设置,select 自定义字段
func GetPrimaryKeyNames ¶
func GetTableName ¶
func Has ¶
func Has[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (t bool, err error)
Has
func Insert ¶
func Insert(db Engine, v any, extra ...*ExtraContext) (num int64, err error)
Insert 插入或者根据主键冲突更新
func InsertOrHas ¶
func InsertOrHas(db Engine, wb *WhereBuilder, d any, extra ...*ExtraContext) (bool, error)
InsertOrHas 根据条件查询是否已存在,不存在则直接插入 应用场景:例如添加 后台管理员 时,如果名字已存在,返回名字重复,否者正常添加。 d insert 的 对象, e 通用设置,select 自定义字段
func List ¶
func List[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (list []T, err error)
func ListP ¶
func ListP[T any](db Engine, wb *WhereBuilder, extra ...*ExtraContext) (list []*T, err error)
func Update ¶
func Update(db Engine, wb *WhereBuilder, dest any, extra ...*ExtraContext) (int64, error)
Types ¶
type ColIndex2FieldNameMap ¶
type ColIndex2FieldNameMap []string
sql返回 row 字段下标 对应的 struct 字段名(""表示不接收该列数据)
type Dialecter ¶
type Dialecter interface {
// contains filtered or unexported methods
}
*
Dialecter 的实现有两种
MysqlDialect PgDialect
内部属性为 ctx *ormContext 有 ormConf OrmConf
dbConfig DbConfig baseTokens []baseToken
type DuplicateKey ¶
type DuplicateKey struct {
// contains filtered or unexported fields
}
func (*DuplicateKey) DoNothing ¶
func (dk *DuplicateKey) DoNothing() *ExtraContext
func (*DuplicateKey) DoReplace ¶
func (dk *DuplicateKey) DoReplace(set ...*SetContext) *ExtraContext
DoReplace 更新字段未设置时,默认更新所有 有值字段
func (*DuplicateKey) DoUpdate ¶
func (dk *DuplicateKey) DoUpdate(set ...*SetContext) *ExtraContext
DoUpdate 更新字段未设置时,默认更新所有 有值字段
type Engine ¶
type Engine interface {
//用db开启tx事务
BeginTx(ctx context.Context, opts *sql.TxOptions) (Engine, error)
Begin() (Engine, error)
Commit() error
Rollback() error
// contains filtered or unexported methods
}
func MustConnect ¶
type EngineBatch ¶
type EngineBatch struct {
// contains filtered or unexported fields
}
todo 下面未重构-------------- 批量操作
type ExtraContext ¶
type ExtraContext struct {
// contains filtered or unexported fields
}
ExtraContext 扩展参数
func E ¶
func E() *ExtraContext
func (*ExtraContext) GetErr ¶
func (e *ExtraContext) GetErr() error
set 中的错误已经被上抛到 ExtraContext,所以只用判断 ExtraContext 的 err
func (*ExtraContext) Limit ¶
func (e *ExtraContext) Limit(num int64, condition ...bool) *ExtraContext
func (*ExtraContext) NoRun ¶
func (e *ExtraContext) NoRun() *ExtraContext
func (*ExtraContext) Offset ¶
func (e *ExtraContext) Offset(num int64, condition ...bool) *ExtraContext
func (*ExtraContext) OrderBy ¶
func (e *ExtraContext) OrderBy(name string, condition ...bool) *ExtraContext
func (*ExtraContext) OrderDescBy ¶
func (e *ExtraContext) OrderDescBy(name string, condition ...bool) *ExtraContext
func (*ExtraContext) ReturnType ¶
func (e *ExtraContext) ReturnType(typ return_type.ReturnType) *ExtraContext
func (*ExtraContext) Select ¶
func (e *ExtraContext) Select(name ...string) *ExtraContext
func (*ExtraContext) Set ¶
func (e *ExtraContext) Set(name string, value any) *ExtraContext
func (*ExtraContext) SetExpression ¶
func (e *ExtraContext) SetExpression(name string, expression string) *ExtraContext
自定义表达式 SetExpression("name", "substr(time('now'), 12)") // sqlite 设置时分秒
func (*ExtraContext) SetIncrement ¶
func (e *ExtraContext) SetIncrement(name string, num any) *ExtraContext
自增,自减
func (*ExtraContext) SetNow ¶
func (e *ExtraContext) SetNow(name string) *ExtraContext
func (*ExtraContext) SetNull ¶
func (e *ExtraContext) SetNull(name string) *ExtraContext
func (*ExtraContext) ShowSql ¶
func (e *ExtraContext) ShowSql() *ExtraContext
func (*ExtraContext) SkipSoftDelete ¶
func (e *ExtraContext) SkipSoftDelete() *ExtraContext
func (*ExtraContext) TableName ¶
func (e *ExtraContext) TableName(name string) *ExtraContext
func (*ExtraContext) WhenDuplicateKey ¶
func (e *ExtraContext) WhenDuplicateKey(name ...string) *DuplicateKey
WhenDuplicateKey 唯一索引冲突,设置索引字段列表;Mysql可不设置,Postgresql 必须设置
type MysqlDialect ¶
type MysqlDialect struct {
// contains filtered or unexported fields
}
type MysqlVersion ¶
type MysqlVersion int
const ( MysqlVersionLast MysqlVersion = iota MysqlVersion5 MysqlVersion = iota MysqlVersion8_0_19 MysqlVersion8_0_20 MysqlVersion8Last )
type NativePrepare ¶
type NativePrepare struct {
// contains filtered or unexported fields
}
type NativeQuery ¶
type NativeQuery struct {
// contains filtered or unexported fields
}
type OrmConf ¶
type OrmConf struct {
//po生成文件目录
PoDir string
//是否覆盖,默认true
IsFileOverride bool
//作者
Author string
//是否开启ActiveRecord模式,默认false
IsActiveRecord bool
IdType int
//表名
//TableNameFun > tag > TableNamePrefix
TableNamePrefix string
TableNameFun func(t reflect.Value, dest any) string
//主键 默认为id
PrimaryKeyNames []string
PrimaryKeyNameFun func(v reflect.Value, dest any) []string
//多租户
TenantIdFieldName string //多租户的 租户字段名 空字符串极为不启用多租户
TenantIdValueFun func() any //租户的id值,获取函数
TenantIgnoreTableFun func(tableName string) bool //该表是否忽略多租户,true忽略该表,即没有多租户
}
type PageConfig ¶
type PageConfig struct {
// contains filtered or unexported fields
}
type PageResult ¶
type PoolConf ¶
type PoolConf struct {
MaxIdleCount int // zero means defaultMaxIdleConns; negative means 0
MaxOpen int // <= 0 means unlimited
MaxLifetime time.Duration // maximum amount of time a connection may be reused
MaxIdleTime time.Duration // maximum amount of time a connection may be idle before being closed
Logger *log.Logger
}
type SetContext ¶
type SetContext struct {
// contains filtered or unexported fields
}
func Set ¶
func Set() *SetContext
func (*SetContext) Field ¶
func (s *SetContext) Field(name ...string) *SetContext
func (*SetContext) Map ¶
func (s *SetContext) Map(v map[string]any) *SetContext
func (*SetContext) Model ¶
func (s *SetContext) Model(v any) *SetContext
这里不对 model 进行解析 在 initColumnsValueSet 中解析
func (*SetContext) Set ¶
func (s *SetContext) Set(name string, value any) *SetContext
func (*SetContext) SetExpression ¶
func (s *SetContext) SetExpression(name string, expression string) *SetContext
自定义表达式 SetExpression("name", "substr(time('now'), 12)") // sqlite 设置时分秒
func (*SetContext) SetIncrement ¶
func (s *SetContext) SetIncrement(name string, num any) *SetContext
自增,自减
func (*SetContext) SetNull ¶
func (s *SetContext) SetNull(name string) *SetContext
type SqlBuilder ¶
type SqlBuilder struct {
// contains filtered or unexported fields
}
func QueryBuild ¶
func QueryBuild(db Engine) *SqlBuilder
func (*SqlBuilder) AppendArg ¶
func (b *SqlBuilder) AppendArg(arg any, conditions ...bool) *SqlBuilder
添加一个 arg,多个断言
func (*SqlBuilder) Arg ¶
func (b *SqlBuilder) Arg(arg any, condition ...bool) *SqlBuilder
func (*SqlBuilder) Args ¶
func (b *SqlBuilder) Args(args ...any) *SqlBuilder
func (*SqlBuilder) Between ¶
func (b *SqlBuilder) Between(whereStr string, begin, end any, condition ...bool) *SqlBuilder
func (*SqlBuilder) BetweenDateTimeOfDate ¶
func (b *SqlBuilder) BetweenDateTimeOfDate(whereStr string, dateBegin, dateEnd *types.Date, condition ...bool) *SqlBuilder
BetweenDateTimeOfDate 用 Date类型,去查询 DateTime 字段
func (*SqlBuilder) BoolWhere ¶
func (b *SqlBuilder) BoolWhere(condition bool, whereStr string, args ...any) *SqlBuilder
func (*SqlBuilder) CountField ¶
func (b *SqlBuilder) CountField(field string, conditions ...bool) *SqlBuilder
自定义count字段
func (*SqlBuilder) FakerTotalNum ¶
func (b *SqlBuilder) FakerTotalNum(num int64, conditions ...bool) *SqlBuilder
分页时,直接使用 fakeTotalNum,不再查询实际总数
func (*SqlBuilder) From ¶
func (b *SqlBuilder) From(name string) *SqlBuilder
from 表名 状态从 selectNoSet 变成 selectSet
func (*SqlBuilder) Join ¶
func (b *SqlBuilder) Join(name string, condition ...bool) *SqlBuilder
join 联表
func (*SqlBuilder) LeftJoin ¶
func (b *SqlBuilder) LeftJoin(name string, condition ...bool) *SqlBuilder
func (*SqlBuilder) Limit ¶
func (b *SqlBuilder) Limit(num int64, condition ...bool) *SqlBuilder
func (*SqlBuilder) LinkWhere ¶
func (b *SqlBuilder) LinkWhere() *SqlBuilder
func (*SqlBuilder) Native ¶
func (b *SqlBuilder) Native(sql string, condition ...bool) *SqlBuilder
func (*SqlBuilder) NoGetList ¶
func (b *SqlBuilder) NoGetList(conditions ...bool) *SqlBuilder
分页时,只查询数量,不返回数据列表
func (*SqlBuilder) Offset ¶
func (b *SqlBuilder) Offset(num int64, condition ...bool) *SqlBuilder
func (*SqlBuilder) OrderBy ¶
func (b *SqlBuilder) OrderBy(name string, condition ...bool) *SqlBuilder
func (*SqlBuilder) OrderDescBy ¶
func (b *SqlBuilder) OrderDescBy(name string, condition ...bool) *SqlBuilder
func (*SqlBuilder) Page ¶
func (b *SqlBuilder) Page(current int64, pageSize int64) *SqlBuilder
func (*SqlBuilder) RightJoin ¶
func (b *SqlBuilder) RightJoin(name string, condition ...bool) *SqlBuilder
func (*SqlBuilder) ScanPage ¶
func (b *SqlBuilder) ScanPage(dest any) (rowsNum int64, dto PageResult, err error)
ScanPage 查询分页
func (*SqlBuilder) Select ¶
func (b *SqlBuilder) Select(arg string, condition ...bool) *SqlBuilder
添加一个 select 字段,多个断言
func (*SqlBuilder) SelectEnd ¶
func (b *SqlBuilder) SelectEnd() *SqlBuilder
func (*SqlBuilder) SelectModel ¶
func (b *SqlBuilder) SelectModel(v any) *SqlBuilder
添加 多个 select 字段,从 model中
func (*SqlBuilder) Where ¶
func (b *SqlBuilder) Where(whereStr string, condition ...bool) *SqlBuilder
func (*SqlBuilder) WhereBuilder ¶
func (b *SqlBuilder) WhereBuilder(w *WhereBuilder) *SqlBuilder
func (*SqlBuilder) WhereIn ¶
func (b *SqlBuilder) WhereIn(whereStr string, args ...any) *SqlBuilder
func (*SqlBuilder) WhereSqlIn ¶
func (b *SqlBuilder) WhereSqlIn(whereStr string, args ...any) *SqlBuilder
WhereSqlIn in ? 当参数列表长度为0时,跳过这个where
type Stmter ¶
type Stmter interface {
Exec(args ...any) (int64, error)
QueryScan(args ...any) *NativePrepare
// contains filtered or unexported methods
}
type TableConf ¶
type TableConf struct {
// contains filtered or unexported fields
}
表配置,会缓存,不可设置动态属性
func GetTableConf ¶
func (*TableConf) AutoIncrements ¶
func (*TableConf) PrimaryKeys ¶
type WhereBuilder ¶
type WhereBuilder struct {
// contains filtered or unexported fields
}
func W ¶
func W() *WhereBuilder
func (*WhereBuilder) And ¶
func (w *WhereBuilder) And(wb *WhereBuilder, condition ...bool) *WhereBuilder
------------------------------------------
func (*WhereBuilder) Arg ¶
func (w *WhereBuilder) Arg(arg any, condition ...bool) *WhereBuilder
func (*WhereBuilder) Args ¶
func (w *WhereBuilder) Args(args ...any) *WhereBuilder
func (*WhereBuilder) Between ¶
func (w *WhereBuilder) Between(query string, arg1, arg2 any, condition ...bool) *WhereBuilder
func (*WhereBuilder) Contains ¶
func (w *WhereBuilder) Contains(query string, arg any, condition ...bool) *WhereBuilder
func (*WhereBuilder) Eq ¶
func (w *WhereBuilder) Eq(query string, arg any, condition ...bool) *WhereBuilder
参数为nil,自动跳过条件
func (*WhereBuilder) FilterPrimaryKey ¶
func (w *WhereBuilder) FilterPrimaryKey(v ...any) *WhereBuilder
func (*WhereBuilder) Greater ¶
func (w *WhereBuilder) Greater(query string, arg any, condition ...bool) *WhereBuilder
大于
func (*WhereBuilder) GreaterEq ¶
func (w *WhereBuilder) GreaterEq(query string, arg any, condition ...bool) *WhereBuilder
大于等于
func (*WhereBuilder) In ¶
func (w *WhereBuilder) In(query string, args ArgArray, condition ...bool) *WhereBuilder
func (*WhereBuilder) IsFalse ¶
func (w *WhereBuilder) IsFalse(query string, condition ...bool) *WhereBuilder
func (*WhereBuilder) IsNotNull ¶
func (w *WhereBuilder) IsNotNull(query string, condition ...bool) *WhereBuilder
func (*WhereBuilder) IsNull ¶
func (w *WhereBuilder) IsNull(query string, condition ...bool) *WhereBuilder
func (*WhereBuilder) Less ¶
func (w *WhereBuilder) Less(query string, arg any, condition ...bool) *WhereBuilder
小于
func (*WhereBuilder) LessEq ¶
func (w *WhereBuilder) LessEq(query string, arg any, condition ...bool) *WhereBuilder
小于等于
func (*WhereBuilder) Like ¶
func (w *WhereBuilder) Like(query string, arg *string, condition ...bool) *WhereBuilder
func (*WhereBuilder) Map ¶
func (w *WhereBuilder) Map(v any, condition ...bool) *WhereBuilder
func (*WhereBuilder) Model ¶
func (w *WhereBuilder) Model(v any, condition ...bool) *WhereBuilder
过滤 软删除
func (*WhereBuilder) Neq ¶
func (w *WhereBuilder) Neq(query string, arg any, condition ...bool) *WhereBuilder
Neq 不等于 当 arg 为 nil 时,不添加条件
func (*WhereBuilder) NoLike ¶
func (w *WhereBuilder) NoLike(query string, arg *string, condition ...bool) *WhereBuilder
func (*WhereBuilder) NotBetween ¶
func (w *WhereBuilder) NotBetween(query string, arg1, arg2 any, condition ...bool) *WhereBuilder
func (*WhereBuilder) NotEq ¶
func (w *WhereBuilder) NotEq(query string, arg any, condition ...bool) *WhereBuilder
参数为nil,不生成条件
func (*WhereBuilder) NotIn ¶
func (w *WhereBuilder) NotIn(query string, args ArgArray, condition ...bool) *WhereBuilder
func (*WhereBuilder) Or ¶
func (w *WhereBuilder) Or(wb *WhereBuilder, condition ...bool) *WhereBuilder
func (*WhereBuilder) PrimaryKey ¶
func (w *WhereBuilder) PrimaryKey(v ...any) *WhereBuilder
Source Files
¶
- api.go
- baseToken.go
- batch.go
- clauseModel.go
- db.go
- db_stmt.go
- db_table_util.go
- dest_type_args.go
- dest_type_common.go
- dest_type_scan.go
- dest_type_target.go
- dialect_db_config_mysql.go
- dialect_db_config_pg.go
- dialect_mysql.go
- dialect_pg.go
- err.go
- extra.go
- field.go
- fl.go
- kind.go
- ldb.go
- ldb_er_builder.go
- ldb_er_extra.go
- ldb_er_native.go
- ldb_er_prepare.go
- ldb_er_table.go
- log.go
- orm_conf.go
- orm_context.go
- row.go
- scan.go
- set.go
- struct.go
- table_conf.go
- tx.go
- tx_stmt.go
- typ.go
- util.go
- where.go