Documentation
¶
Index ¶
- Variables
- type Builder
- func (b *Builder) AndGroup(fn func(*Builder)) *Builder
- func (b *Builder) Asc(field string) *Builder
- func (b *Builder) Desc(field string) *Builder
- func (b *Builder) Distinct(field string) *Builder
- func (b *Builder) Eq(field string, value interface{}) *Builder
- func (b *Builder) Gt(field string, value interface{}) *Builder
- func (b *Builder) Gte(field string, value interface{}) *Builder
- func (b *Builder) Lt(field string, value interface{}) *Builder
- func (b *Builder) Lte(field string, value interface{}) *Builder
- func (b *Builder) Ne(field string, value interface{}) *Builder
- func (b *Builder) NotGroup(fn func(*Builder)) *Builder
- func (b *Builder) Options() []Option
- func (b *Builder) OrGroup(fn func(*Builder)) *Builder
- func (b *Builder) Where(opts ...Option) *Builder
- type Distinct
- type Field
- func (f Field) Ascending() *Order
- func (f Field) Descending() *Order
- func (f Field) Distinct() *Distinct
- func (f Field) Equal(value interface{}) *Filter
- func (f Field) GreaterOrEqual(value interface{}) *Filter
- func (f Field) GreaterThan(value interface{}) *Filter
- func (f Field) LessOrEqual(value interface{}) *Filter
- func (f Field) LessThan(value interface{}) *Filter
- func (f Field) NotEqual(value interface{}) *Filter
- type FieldMapper
- type Filter
- type Logical
- type LogicalOperator
- type Operator
- type Option
- type OptionType
- type Order
- type QueryBuilder
- type SortOrder
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyFieldMapper = make(FieldMapper)
Functions ¶
This section is empty.
Types ¶
type Builder ¶ added in v0.3.2
type Builder struct {
// contains filtered or unexported fields
}
Builder offers a fluent API to collect query options without manually constructing Field/Logical types at every call site.
func (*Builder) AndGroup ¶ added in v0.3.2
AndGroup creates a logical AND group using the nested builder.
type Distinct ¶ added in v0.2.8
type Distinct struct {
Field Field
}
func DistinctField ¶ added in v0.3.2
DistinctField helps creating a distinct option without constructing Field manually.
func (Distinct) OptionType ¶ added in v0.2.8
func (d Distinct) OptionType() OptionType
type Field ¶
type Field string
func (Field) Descending ¶
func (Field) GreaterOrEqual ¶
func (Field) GreaterThan ¶
func (Field) LessOrEqual ¶
type FieldMapper ¶
func (*FieldMapper) Get ¶
func (m *FieldMapper) Get(field Field) string
func (*FieldMapper) Map ¶ added in v0.2.10
func (m *FieldMapper) Map(fields []Field) []string
type Filter ¶
func (*Filter) OptionType ¶
func (f *Filter) OptionType() OptionType
type Logical ¶
type Logical struct {
Operator LogicalOperator
Filters []Option // Filter or Logical
}
func (*Logical) OptionType ¶
func (l *Logical) OptionType() OptionType
type LogicalOperator ¶
type LogicalOperator string
const ( OpAnd LogicalOperator = "and" OpOr LogicalOperator = "or" OpNot LogicalOperator = "not" )
type OptionType ¶
type OptionType int
const ( OptionTypeFilter OptionType = iota OptionTypeLogical OptionTypeSort OptionTypeDistinct )
type Order ¶
func Asc ¶ added in v0.3.2
Asc creates an ascending order option without constructing Field manually.
func Desc ¶ added in v0.3.2
Desc creates a descending order option without constructing Field manually.
func (Order) OptionType ¶
func (o Order) OptionType() OptionType
type QueryBuilder ¶
type QueryBuilder[T any] interface { Build(options ...Option) T WithFieldMapper(mapper FieldMapper) QueryBuilder[T] }
QueryBuilder is a function that takes a filter and returns a new filter
Click to show internal directories.
Click to hide internal directories.