clause

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 6 Imported by: 0

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 request.Ordered](db *gorm.DB, req *request.ListReq[O]) ([]T, error)

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

func ListClause

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

func NewClause added in v1.6.13

func NewClause(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 ChainClause added in v1.6.13

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

func (ChainClause) ById added in v1.6.13

func (c ChainClause) ById(id int) ChainClause

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

func (ChainClause) ByIdNoCheck added in v1.6.13

func (c ChainClause) ByIdNoCheck(id int) ChainClause

func (ChainClause) ByName added in v1.6.13

func (c ChainClause) ByName(name string) ChainClause

func (ChainClause) ByNameNoCheck added in v1.6.13

func (c ChainClause) ByNameNoCheck(name string) ChainClause

func (ChainClause) Exec added in v1.6.13

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

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) ByIdNoCheck added in v1.6.13

func (c ChainDB) ByIdNoCheck(id int) ChainDB

func (ChainDB) ByName

func (c ChainDB) ByName(name string) ChainDB

func (ChainDB) ByNameNoCheck added in v1.6.13

func (c ChainDB) ByNameNoCheck(name string) ChainDB

func (ChainDB) List

func (c ChainDB) List(dest any) ChainDB

type Clause3 added in v1.6.13

type Clause3 []clause.Interface

func (Clause3) ByIdNoCheck added in v1.6.13

func (c Clause3) ByIdNoCheck(id int) Clause3

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.FilterExpr

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 request.Ordered] request.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 request.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