clause

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	IDEQUAL   = dbi.ColumnId + dbi.ExprEqual
	NAMEEQUAL = dbi.ColumnName + dbi.ExprEqual
)

Variables

This section is empty.

Functions

func DateBetween

func DateBetween(column, dateStart, dateEnd string) clause.Expression

func List

func List[T any, O querytypes.Ordered](db *gorm.DB, req *querytypes.ListReq[O]) ([]T, error)

unsupported data,完全不可用 deprecated: 不可用

func ListClause

func ListClause[O querytypes.Ordered](req *querytypes.ListReq[O]) []clause.Expression

func NewScope

func NewScope(field string, op dbi.Operation, args ...interface{}) func(*gorm.DB) *gorm.DB

func NewWhereClause

func NewWhereClause(field string, op dbi.Operation, args ...interface{}) clause.Expression

func Page

func Page(pageNo, pageSize int) clause.Limit

func Sort

func Sort(column string, typ request.SortType) clause.Expression

func TableName

func TableName(tx *gorm.DB, name string) *gorm.DB

Types

type ChainDB

type ChainDB func(db *gorm.DB) *gorm.DB

func NewChainDB

func NewChainDB(ctx context.Context) ChainDB

func (ChainDB) ById

func (c ChainDB) ById(id int) ChainDB

func (ChainDB) ByName

func (c ChainDB) ByName(name string) ChainDB

func (ChainDB) List

func (c ChainDB) List(db *gorm.DB)

type Clause

type Clause []func(db *gorm.DB) *gorm.DB

func (Clause) ById

func (c Clause) ById(id int) Clause

db.Scope(ById(1),ByName("a")).First(v)

func (Clause) ByName

func (c Clause) ByName(name string) Clause

func (Clause) Exec

func (c Clause) Exec(db *gorm.DB) *gorm.DB

type Clause2

type Clause2 struct {
	Expr []string
	Var  []interface{}
}

func (*Clause2) Build

func (c *Clause2) Build(db *gorm.DB) *gorm.DB

func (*Clause2) ById

func (c *Clause2) ById(id int) *Clause2

db.Scope(ById(1),ByName("a").Build()).First(v)

func (*Clause2) ByName

func (c *Clause2) ByName(name string) *Clause2

func (*Clause2) Exec

func (c *Clause2) Exec(db *gorm.DB) *gorm.DB

type EmptyClause

type EmptyClause struct {
}

func (*EmptyClause) Build

func (receiver *EmptyClause) Build(builder clause.Builder)

func (*EmptyClause) ModifyStatement

func (receiver *EmptyClause) ModifyStatement(*gorm.Statement)

type Expression

type Expression dbi.FilterExpression

func (*Expression) Clause

func (e *Expression) Clause() func(*gorm.DB) *gorm.DB

type Limit

type Limit struct {
	Limit  int
	Offset int
}

Limit limit clause

func (Limit) Build

func (limit Limit) Build(builder clause.Builder)

Build build where clause

func (Limit) MergeClause

func (limit Limit) MergeClause(clause *clause.Clause)

MergeClause merge order by clauses

func (Limit) Name

func (limit Limit) Name() string

Name where clause name

type ListReq

type ListReq[T querytypes.Ordered] querytypes.ListReq[T]

func (*ListReq[O]) Clause

func (req *ListReq[O]) Clause() []clause.Expression

type PageSortReq

type PageSortReq request.PageSortReq

func (*PageSortReq) Clause

func (req *PageSortReq) Clause() []clause.Expression

type RangeReq

type RangeReq[T _type.Ordered] request.RangeReq[T]

func (*RangeReq[T]) Clause

func (req *RangeReq[T]) Clause() clause.Expression

Jump to

Keyboard shortcuts

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