query

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Q       = new(Query)
	Example *example
)

Functions

func SetDefault

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

Types

type IExampleDo

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

	GetById(id string) (result *model.Example, err error)
	DeleteById(id string) (rowsAffected int64, err error)
	Query(id string, name string) (result []*model.Example, err error)
}

type Query

type Query struct {
	Example example
	// 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 }

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