query

package
v0.0.0-...-585f28f Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Q          = new(Query)
	API        *aPI
	Department *department
	Menu       *menu
	Role       *role
	User       *user
)

Functions

func SetDefault

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

Types

type IAPIDo

type IAPIDo interface {
	gen.SubQuery
	Debug() IAPIDo
	WithContext(ctx context.Context) IAPIDo
	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
	ReplaceDB(db *gorm.DB)
	ReadDB() IAPIDo
	WriteDB() IAPIDo
	As(alias string) gen.Dao
	Session(config *gorm.Session) IAPIDo
	Columns(cols ...field.Expr) gen.Columns
	Clauses(conds ...clause.Expression) IAPIDo
	Not(conds ...gen.Condition) IAPIDo
	Or(conds ...gen.Condition) IAPIDo
	Select(conds ...field.Expr) IAPIDo
	Where(conds ...gen.Condition) IAPIDo
	Order(conds ...field.Expr) IAPIDo
	Distinct(cols ...field.Expr) IAPIDo
	Omit(cols ...field.Expr) IAPIDo
	Join(table schema.Tabler, on ...field.Expr) IAPIDo
	LeftJoin(table schema.Tabler, on ...field.Expr) IAPIDo
	RightJoin(table schema.Tabler, on ...field.Expr) IAPIDo
	Group(cols ...field.Expr) IAPIDo
	Having(conds ...gen.Condition) IAPIDo
	Limit(limit int) IAPIDo
	Offset(offset int) IAPIDo
	Count() (count int64, err error)
	Scopes(funcs ...func(gen.Dao) gen.Dao) IAPIDo
	Unscoped() IAPIDo
	Create(values ...*model.API) error
	CreateInBatches(values []*model.API, batchSize int) error
	Save(values ...*model.API) error
	First() (*model.API, error)
	Take() (*model.API, error)
	Last() (*model.API, error)
	Find() ([]*model.API, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.API, err error)
	FindInBatches(result *[]*model.API, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*model.API) (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) IAPIDo
	Assign(attrs ...field.AssignExpr) IAPIDo
	Joins(fields ...field.RelationField) IAPIDo
	Preload(fields ...field.RelationField) IAPIDo
	FirstOrInit() (*model.API, error)
	FirstOrCreate() (*model.API, error)
	FindByPage(offset int, limit int) (result []*model.API, 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) IAPIDo
	UnderlyingDB() *gorm.DB
	schema.Tabler
}

type IDepartmentDo

type IDepartmentDo interface {
	gen.SubQuery
	Debug() IDepartmentDo
	WithContext(ctx context.Context) IDepartmentDo
	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
	ReplaceDB(db *gorm.DB)
	ReadDB() IDepartmentDo
	WriteDB() IDepartmentDo
	As(alias string) gen.Dao
	Session(config *gorm.Session) IDepartmentDo
	Columns(cols ...field.Expr) gen.Columns
	Clauses(conds ...clause.Expression) IDepartmentDo
	Not(conds ...gen.Condition) IDepartmentDo
	Or(conds ...gen.Condition) IDepartmentDo
	Select(conds ...field.Expr) IDepartmentDo
	Where(conds ...gen.Condition) IDepartmentDo
	Order(conds ...field.Expr) IDepartmentDo
	Distinct(cols ...field.Expr) IDepartmentDo
	Omit(cols ...field.Expr) IDepartmentDo
	Join(table schema.Tabler, on ...field.Expr) IDepartmentDo
	LeftJoin(table schema.Tabler, on ...field.Expr) IDepartmentDo
	RightJoin(table schema.Tabler, on ...field.Expr) IDepartmentDo
	Group(cols ...field.Expr) IDepartmentDo
	Having(conds ...gen.Condition) IDepartmentDo
	Limit(limit int) IDepartmentDo
	Offset(offset int) IDepartmentDo
	Count() (count int64, err error)
	Scopes(funcs ...func(gen.Dao) gen.Dao) IDepartmentDo
	Unscoped() IDepartmentDo
	Create(values ...*model.Department) error
	CreateInBatches(values []*model.Department, batchSize int) error
	Save(values ...*model.Department) error
	First() (*model.Department, error)
	Take() (*model.Department, error)
	Last() (*model.Department, error)
	Find() ([]*model.Department, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Department, err error)
	FindInBatches(result *[]*model.Department, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*model.Department) (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) IDepartmentDo
	Assign(attrs ...field.AssignExpr) IDepartmentDo
	Joins(fields ...field.RelationField) IDepartmentDo
	Preload(fields ...field.RelationField) IDepartmentDo
	FirstOrInit() (*model.Department, error)
	FirstOrCreate() (*model.Department, error)
	FindByPage(offset int, limit int) (result []*model.Department, 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) IDepartmentDo
	UnderlyingDB() *gorm.DB
	schema.Tabler

	GetById(id int) (result model.Department, err error)
	DeleteByID(id int64) (err error)
}

type IMenuDo

type IMenuDo interface {
	gen.SubQuery
	Debug() IMenuDo
	WithContext(ctx context.Context) IMenuDo
	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
	ReplaceDB(db *gorm.DB)
	ReadDB() IMenuDo
	WriteDB() IMenuDo
	As(alias string) gen.Dao
	Session(config *gorm.Session) IMenuDo
	Columns(cols ...field.Expr) gen.Columns
	Clauses(conds ...clause.Expression) IMenuDo
	Not(conds ...gen.Condition) IMenuDo
	Or(conds ...gen.Condition) IMenuDo
	Select(conds ...field.Expr) IMenuDo
	Where(conds ...gen.Condition) IMenuDo
	Order(conds ...field.Expr) IMenuDo
	Distinct(cols ...field.Expr) IMenuDo
	Omit(cols ...field.Expr) IMenuDo
	Join(table schema.Tabler, on ...field.Expr) IMenuDo
	LeftJoin(table schema.Tabler, on ...field.Expr) IMenuDo
	RightJoin(table schema.Tabler, on ...field.Expr) IMenuDo
	Group(cols ...field.Expr) IMenuDo
	Having(conds ...gen.Condition) IMenuDo
	Limit(limit int) IMenuDo
	Offset(offset int) IMenuDo
	Count() (count int64, err error)
	Scopes(funcs ...func(gen.Dao) gen.Dao) IMenuDo
	Unscoped() IMenuDo
	Create(values ...*model.Menu) error
	CreateInBatches(values []*model.Menu, batchSize int) error
	Save(values ...*model.Menu) error
	First() (*model.Menu, error)
	Take() (*model.Menu, error)
	Last() (*model.Menu, error)
	Find() ([]*model.Menu, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Menu, err error)
	FindInBatches(result *[]*model.Menu, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*model.Menu) (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) IMenuDo
	Assign(attrs ...field.AssignExpr) IMenuDo
	Joins(fields ...field.RelationField) IMenuDo
	Preload(fields ...field.RelationField) IMenuDo
	FirstOrInit() (*model.Menu, error)
	FirstOrCreate() (*model.Menu, error)
	FindByPage(offset int, limit int) (result []*model.Menu, 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) IMenuDo
	UnderlyingDB() *gorm.DB
	schema.Tabler

	GetById(id int) (result model.Menu, err error)
	DeleteByID(id int64) (err error)
}

type IRoleDo

type IRoleDo interface {
	gen.SubQuery
	Debug() IRoleDo
	WithContext(ctx context.Context) IRoleDo
	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
	ReplaceDB(db *gorm.DB)
	ReadDB() IRoleDo
	WriteDB() IRoleDo
	As(alias string) gen.Dao
	Session(config *gorm.Session) IRoleDo
	Columns(cols ...field.Expr) gen.Columns
	Clauses(conds ...clause.Expression) IRoleDo
	Not(conds ...gen.Condition) IRoleDo
	Or(conds ...gen.Condition) IRoleDo
	Select(conds ...field.Expr) IRoleDo
	Where(conds ...gen.Condition) IRoleDo
	Order(conds ...field.Expr) IRoleDo
	Distinct(cols ...field.Expr) IRoleDo
	Omit(cols ...field.Expr) IRoleDo
	Join(table schema.Tabler, on ...field.Expr) IRoleDo
	LeftJoin(table schema.Tabler, on ...field.Expr) IRoleDo
	RightJoin(table schema.Tabler, on ...field.Expr) IRoleDo
	Group(cols ...field.Expr) IRoleDo
	Having(conds ...gen.Condition) IRoleDo
	Limit(limit int) IRoleDo
	Offset(offset int) IRoleDo
	Count() (count int64, err error)
	Scopes(funcs ...func(gen.Dao) gen.Dao) IRoleDo
	Unscoped() IRoleDo
	Create(values ...*model.Role) error
	CreateInBatches(values []*model.Role, batchSize int) error
	Save(values ...*model.Role) error
	First() (*model.Role, error)
	Take() (*model.Role, error)
	Last() (*model.Role, error)
	Find() ([]*model.Role, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Role, err error)
	FindInBatches(result *[]*model.Role, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*model.Role) (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) IRoleDo
	Assign(attrs ...field.AssignExpr) IRoleDo
	Joins(fields ...field.RelationField) IRoleDo
	Preload(fields ...field.RelationField) IRoleDo
	FirstOrInit() (*model.Role, error)
	FirstOrCreate() (*model.Role, error)
	FindByPage(offset int, limit int) (result []*model.Role, 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) IRoleDo
	UnderlyingDB() *gorm.DB
	schema.Tabler

	GetById(id int) (result model.Role, err error)
	DeleteByID(id int64) (err error)
}

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 ...*model.User) error
	CreateInBatches(values []*model.User, batchSize int) error
	Save(values ...*model.User) error
	First() (*model.User, error)
	Take() (*model.User, error)
	Last() (*model.User, error)
	Find() ([]*model.User, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.User, err error)
	FindInBatches(result *[]*model.User, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*model.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() (*model.User, error)
	FirstOrCreate() (*model.User, error)
	FindByPage(offset int, limit int) (result []*model.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

	GetById(id int) (result model.User, err error)
	DeleteByID(id int64) (err error)
}

type Query

type Query struct {
	API        aPI
	Department department
	Menu       menu
	Role       role
	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