clause

package
v2.1.12 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderByAsc  string = "ASC"
	OrderByDesc string = "DESC"
)

Variables

View Source
var (
	ErrFilterUnknownOperator = apperr.New("filter_unknown_operator", apperr.WithTextTranslate(i18n.ErrFilterUnknownOperator), apperr.WithCode(code.InvalidArgument))
	ErrFilterInvalidOperator = apperr.New("filter_invalid_operator", apperr.WithTextTranslate(i18n.ErrFilterInvalidOperator), apperr.WithCode(code.InvalidArgument))
	ErrFilterUnknownColumn   = apperr.New("filter_unknown_column", apperr.WithTextTranslate(i18n.ErrFilterUnknownColumn), apperr.WithCode(code.InvalidArgument))
	ErrFilterInvalidValue    = apperr.New("filter_invalid_value", apperr.WithTextTranslate(i18n.ErrFilterInvalidValue), apperr.WithCode(code.InvalidArgument))
)
View Source
var (
	ErrOrderByUnknownColumn = apperr.New("order_by_unknown_column", apperr.WithTextTranslate(i18n.ErrOrderByUnknownColumn), apperr.WithCode(code.InvalidArgument))
)

Functions

func Limit added in v2.0.4

func Limit(limit, offset int) func(tx *gorm.DB) *gorm.DB

func OnConflict

func OnConflict(onConflict []interface{}, doUpdates []interface{}) clause.OnConflict

func OrderBy

func OrderBy(quoteTo func(string) string, orderBy map[string]string, tableName string) func(tx *gorm.DB) *gorm.DB

func OrderByFilter added in v2.1.9

func OrderByFilter(quoteTo func(string) string, orderBy map[string]string, fieldOrderBy FieldOrderBy) (string, []string, error)

func Returning

func Returning(columns ...string) clause.Returning

func Where

func Where(quoteTo func(string) string, query string, args ...interface{}) func(tx *gorm.DB) *gorm.DB

func WhereFilter

func WhereFilter(quoteTo func(string) string, expression *ExpressionWhere, fieldSearchable FieldSearchable) (string, []interface{}, []string, error)

Types

type ExpressionWhere added in v2.1.9

type ExpressionWhere struct {
	Expressions []ExpressionWhere
	Column      string
	Operation   string
	Value       string
}

type FieldOrderBy added in v2.1.9

type FieldOrderBy map[string]Order

type FieldSearchable

type FieldSearchable map[string]Search

type Order added in v2.1.9

type Order struct {
	Column string
	Join   string
}
type Search struct {
	Column string
	Type   Type
	Join   string
}

type Type added in v2.1.9

type Type string
const (
	String   Type = "string"
	Int      Type = "int"
	Bool     Type = "bool"
	DateTime Type = "datetime"
)

Jump to

Keyboard shortcuts

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