1 Star 0 Fork 21

小牧童在眺望/gen

forked from gorm/gen 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
interface.go 2.43 KB
一键复制 编辑 原始数据 按行查看 历史
riverchu 提交于 2021-09-28 18:30 . feat: field set value
package gen
import (
"database/sql"
"gorm.io/gorm"
"gorm.io/gorm/schema"
"gorm.io/gen/field"
)
type (
// Condition query condition
// field.Expr and subquery are expect value
Condition interface {
BeCond() interface{}
CondError() error
}
)
var (
_ Condition = (field.Expr)(nil)
_ Condition = (field.Value)(nil)
_ Condition = (subQuery)(nil)
_ Condition = (Dao)(nil)
)
type subQuery interface {
underlyingDB() *gorm.DB
underlyingDO() *DO
Condition
}
// Dao CRUD methods
type Dao interface {
subQuery
As(alias string) Dao
Not(conds ...Condition) Dao
Or(conds ...Condition) Dao
Select(columns ...field.Expr) Dao
Where(conds ...Condition) Dao
Order(columns ...field.Expr) Dao
Distinct(columns ...field.Expr) Dao
Omit(columns ...field.Expr) Dao
Join(table schema.Tabler, conds ...field.Expr) Dao
LeftJoin(table schema.Tabler, conds ...field.Expr) Dao
RightJoin(table schema.Tabler, conds ...field.Expr) Dao
Group(columns ...field.Expr) Dao
Having(conds ...Condition) Dao
Limit(limit int) Dao
Offset(offset int) Dao
Scopes(funcs ...func(Dao) Dao) Dao
Unscoped() Dao
Attrs(attrs ...field.AssignExpr) Dao
Assign(attrs ...field.AssignExpr) Dao
Joins(field field.RelationField) Dao
Preload(field field.RelationField) Dao
Create(value interface{}) error
CreateInBatches(value interface{}, batchSize int) error
Save(value interface{}) error
First() (result interface{}, err error)
Take() (result interface{}, err error)
Last() (result interface{}, err error)
Find() (results interface{}, err error)
FindInBatch(batchSize int, fc func(tx Dao, batch int) error) (results interface{}, err error)
FindInBatches(dest interface{}, batchSize int, fc func(tx Dao, batch int) error) error
FirstOrInit() (result interface{}, err error)
FirstOrCreate() (result interface{}, err error)
Update(column field.Expr, value interface{}) (info resultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info resultInfo, err error)
Updates(values interface{}) (info resultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info resultInfo, err error)
UpdateColumns(values interface{}) (info resultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info resultInfo, err error)
Delete() (info resultInfo, err error)
Count() (int64, error)
Row() *sql.Row
Rows() (*sql.Rows, error)
Scan(dest interface{}) error
Pluck(column field.Expr, dest interface{}) error
ScanRows(rows *sql.Rows, dest interface{}) error
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mut000/gen.git
git@gitee.com:mut000/gen.git
mut000
gen
gen
master

搜索帮助