db

package
v0.0.0-...-e2de2ce Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Q            = new(Query)
	Appliance    *appliance
	Registration *registration
	System       *system
)
View Source
var Pool *gorm.DB

Functions

func Initialize

func Initialize()

func SetDefault

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

Types

type IApplianceDo

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

	GetByID(id int) (result model.Appliance, err error)
}

type IRegistrationDo

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

	GetByID(id int) (result model.Registration, err error)
	GetBySID(sid string) (result model.Registration, err error)
}

type ISystemDo

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

	GetByID(id int) (result model.System, err error)
}

type Query

type Query struct {
	Appliance    appliance
	Registration registration
	System       system
	// 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