dao

package
v0.1.0-beta.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Q    = new(Query)
	Log  *log
	Tiku *tiku
	User *user
)

Functions

func SetDefault

func SetDefault(db *gorm.DB, opts ...gen.DOOption)

Types

type ILogDo

type ILogDo interface {
	gen.SubQuery
	Debug() ILogDo
	WithContext(ctx context.Context) ILogDo
	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
	ReplaceDB(db *gorm.DB)
	ReadDB() ILogDo
	WriteDB() ILogDo
	As(alias string) gen.Dao
	Session(config *gorm.Session) ILogDo
	Columns(cols ...field.Expr) gen.Columns
	Clauses(conds ...clause.Expression) ILogDo
	Not(conds ...gen.Condition) ILogDo
	Or(conds ...gen.Condition) ILogDo
	Select(conds ...field.Expr) ILogDo
	Where(conds ...gen.Condition) ILogDo
	Order(conds ...field.Expr) ILogDo
	Distinct(cols ...field.Expr) ILogDo
	Omit(cols ...field.Expr) ILogDo
	Join(table schema.Tabler, on ...field.Expr) ILogDo
	LeftJoin(table schema.Tabler, on ...field.Expr) ILogDo
	RightJoin(table schema.Tabler, on ...field.Expr) ILogDo
	Group(cols ...field.Expr) ILogDo
	Having(conds ...gen.Condition) ILogDo
	Limit(limit int) ILogDo
	Offset(offset int) ILogDo
	Count() (count int64, err error)
	Scopes(funcs ...func(gen.Dao) gen.Dao) ILogDo
	Unscoped() ILogDo
	Create(values ...*entity.Log) error
	CreateInBatches(values []*entity.Log, batchSize int) error
	Save(values ...*entity.Log) error
	First() (*entity.Log, error)
	Take() (*entity.Log, error)
	Last() (*entity.Log, error)
	Find() ([]*entity.Log, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*entity.Log, err error)
	FindInBatches(result *[]*entity.Log, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*entity.Log) (info gen.ResultInfo, err error)
	Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
	UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
	Updates(value interface{}) (info gen.ResultInfo, err error)
	UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
	UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
	UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
	UpdateFrom(q gen.SubQuery) gen.Dao
	Attrs(attrs ...field.AssignExpr) ILogDo
	Assign(attrs ...field.AssignExpr) ILogDo
	Joins(fields ...field.RelationField) ILogDo
	Preload(fields ...field.RelationField) ILogDo
	FirstOrInit() (*entity.Log, error)
	FirstOrCreate() (*entity.Log, error)
	FindByPage(offset int, limit int) (result []*entity.Log, count int64, err error)
	ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
	Scan(result interface{}) (err error)
	Returning(value interface{}, columns ...string) ILogDo
	UnderlyingDB() *gorm.DB
	schema.Tabler
}

type ITikuDo

type ITikuDo interface {
	gen.SubQuery
	Debug() ITikuDo
	WithContext(ctx context.Context) ITikuDo
	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
	ReplaceDB(db *gorm.DB)
	ReadDB() ITikuDo
	WriteDB() ITikuDo
	As(alias string) gen.Dao
	Session(config *gorm.Session) ITikuDo
	Columns(cols ...field.Expr) gen.Columns
	Clauses(conds ...clause.Expression) ITikuDo
	Not(conds ...gen.Condition) ITikuDo
	Or(conds ...gen.Condition) ITikuDo
	Select(conds ...field.Expr) ITikuDo
	Where(conds ...gen.Condition) ITikuDo
	Order(conds ...field.Expr) ITikuDo
	Distinct(cols ...field.Expr) ITikuDo
	Omit(cols ...field.Expr) ITikuDo
	Join(table schema.Tabler, on ...field.Expr) ITikuDo
	LeftJoin(table schema.Tabler, on ...field.Expr) ITikuDo
	RightJoin(table schema.Tabler, on ...field.Expr) ITikuDo
	Group(cols ...field.Expr) ITikuDo
	Having(conds ...gen.Condition) ITikuDo
	Limit(limit int) ITikuDo
	Offset(offset int) ITikuDo
	Count() (count int64, err error)
	Scopes(funcs ...func(gen.Dao) gen.Dao) ITikuDo
	Unscoped() ITikuDo
	Create(values ...*entity.Tiku) error
	CreateInBatches(values []*entity.Tiku, batchSize int) error
	Save(values ...*entity.Tiku) error
	First() (*entity.Tiku, error)
	Take() (*entity.Tiku, error)
	Last() (*entity.Tiku, error)
	Find() ([]*entity.Tiku, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*entity.Tiku, err error)
	FindInBatches(result *[]*entity.Tiku, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*entity.Tiku) (info gen.ResultInfo, err error)
	Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
	UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
	Updates(value interface{}) (info gen.ResultInfo, err error)
	UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
	UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
	UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
	UpdateFrom(q gen.SubQuery) gen.Dao
	Attrs(attrs ...field.AssignExpr) ITikuDo
	Assign(attrs ...field.AssignExpr) ITikuDo
	Joins(fields ...field.RelationField) ITikuDo
	Preload(fields ...field.RelationField) ITikuDo
	FirstOrInit() (*entity.Tiku, error)
	FirstOrCreate() (*entity.Tiku, error)
	FindByPage(offset int, limit int) (result []*entity.Tiku, count int64, err error)
	ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
	Scan(result interface{}) (err error)
	Returning(value interface{}, columns ...string) ITikuDo
	UnderlyingDB() *gorm.DB
	schema.Tabler
}

type IUserDo

type IUserDo interface {
	gen.SubQuery
	Debug() IUserDo
	WithContext(ctx context.Context) IUserDo
	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
	ReplaceDB(db *gorm.DB)
	ReadDB() IUserDo
	WriteDB() IUserDo
	As(alias string) gen.Dao
	Session(config *gorm.Session) IUserDo
	Columns(cols ...field.Expr) gen.Columns
	Clauses(conds ...clause.Expression) IUserDo
	Not(conds ...gen.Condition) IUserDo
	Or(conds ...gen.Condition) IUserDo
	Select(conds ...field.Expr) IUserDo
	Where(conds ...gen.Condition) IUserDo
	Order(conds ...field.Expr) IUserDo
	Distinct(cols ...field.Expr) IUserDo
	Omit(cols ...field.Expr) IUserDo
	Join(table schema.Tabler, on ...field.Expr) IUserDo
	LeftJoin(table schema.Tabler, on ...field.Expr) IUserDo
	RightJoin(table schema.Tabler, on ...field.Expr) IUserDo
	Group(cols ...field.Expr) IUserDo
	Having(conds ...gen.Condition) IUserDo
	Limit(limit int) IUserDo
	Offset(offset int) IUserDo
	Count() (count int64, err error)
	Scopes(funcs ...func(gen.Dao) gen.Dao) IUserDo
	Unscoped() IUserDo
	Create(values ...*entity.User) error
	CreateInBatches(values []*entity.User, batchSize int) error
	Save(values ...*entity.User) error
	First() (*entity.User, error)
	Take() (*entity.User, error)
	Last() (*entity.User, error)
	Find() ([]*entity.User, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*entity.User, err error)
	FindInBatches(result *[]*entity.User, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*entity.User) (info gen.ResultInfo, err error)
	Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
	UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
	Updates(value interface{}) (info gen.ResultInfo, err error)
	UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
	UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
	UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
	UpdateFrom(q gen.SubQuery) gen.Dao
	Attrs(attrs ...field.AssignExpr) IUserDo
	Assign(attrs ...field.AssignExpr) IUserDo
	Joins(fields ...field.RelationField) IUserDo
	Preload(fields ...field.RelationField) IUserDo
	FirstOrInit() (*entity.User, error)
	FirstOrCreate() (*entity.User, error)
	FindByPage(offset int, limit int) (result []*entity.User, count int64, err error)
	ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
	Scan(result interface{}) (err error)
	Returning(value interface{}, columns ...string) IUserDo
	UnderlyingDB() *gorm.DB
	schema.Tabler
}

type Query

type Query struct {
	Log  log
	Tiku tiku
	User user
	// contains filtered or unexported fields
}

func Use

func Use(db *gorm.DB, opts ...gen.DOOption) *Query

func (*Query) Available

func (q *Query) Available() bool

func (*Query) Begin

func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx

func (*Query) ReadDB

func (q *Query) ReadDB() *Query

func (*Query) ReplaceDB

func (q *Query) ReplaceDB(db *gorm.DB) *Query

func (*Query) Transaction

func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error

func (*Query) WithContext

func (q *Query) WithContext(ctx context.Context) *queryCtx

func (*Query) WriteDB

func (q *Query) WriteDB() *Query

type QueryTx

type QueryTx struct {
	*Query
	Error error
}

func (*QueryTx) Commit

func (q *QueryTx) Commit() error

func (*QueryTx) Rollback

func (q *QueryTx) Rollback() error

func (*QueryTx) RollbackTo

func (q *QueryTx) RollbackTo(name string) error

func (*QueryTx) SavePoint

func (q *QueryTx) SavePoint(name string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL