Documentation ¶
Overview ¶
Package where is used to handle GORM's Where query conditions.
Index ¶
- func RegisterTenant(key string, valueFunc func(context.Context) string)
- type Option
- type Options
- func (whr *Options) C(conds ...clause.Expression) *Options
- func (whr *Options) F(kvs ...any) *Options
- func (whr *Options) L(limit int) *Options
- func (whr *Options) O(offset int) *Options
- func (whr *Options) P(page int, pageSize int) *Options
- func (whr *Options) T(ctx context.Context) *Options
- func (whr *Options) Where(db *gorm.DB) *gorm.DB
- type Tenant
- type Where
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Options)
Option defines a function type that modifies Options.
func WithClauses ¶
func WithClauses(conds ...clause.Expression) Option
WithClauses appends clauses to the Clauses field in Options.
func WithFilter ¶
WithFilter initializes the Filters field in Options with the given filter criteria.
func WithOffset ¶
WithOffset initializes the Offset field in Options with the given offset value.
type Options ¶
type Options struct { // Offset defines the starting point for pagination. // +optional Offset int `json:"offset"` // Limit defines the maximum number of results to return. // +optional Limit int `json:"limit"` // Filters contains key-value pairs for filtering records. Filters map[any]any // Clauses contains custom clauses to be appended to the query. Clauses []clause.Expression }
Options holds the options for GORM's Where query conditions.
func C ¶
func C(conds ...clause.Expression) *Options
C is a convenience function to create a new Options with conditions.
func (*Options) C ¶
func (whr *Options) C(conds ...clause.Expression) *Options
C adds conditions to the query.
Click to show internal directories.
Click to hide internal directories.