builder

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterBuilder

type FilterBuilder struct {
	// contains filtered or unexported fields
}

func NewFilterBuilder

func NewFilterBuilder() *FilterBuilder

func (*FilterBuilder) And

func (b *FilterBuilder) And() IFilterBuilder

func (*FilterBuilder) Build

func (b *FilterBuilder) Build() string

func (*FilterBuilder) KBoolV

func (b *FilterBuilder) KBoolV(key string, value bool) IFilterBuilder

func (*FilterBuilder) KNumberV

func (b *FilterBuilder) KNumberV(key string, value float64) IFilterBuilder

func (*FilterBuilder) KObjectV

func (b *FilterBuilder) KObjectV(key string, value FilterBuilderObject) IFilterBuilder

func (*FilterBuilder) KStringV

func (b *FilterBuilder) KStringV(key string, value string) IFilterBuilder

func (*FilterBuilder) Or

func (b *FilterBuilder) Or() IFilterBuilder

func (*FilterBuilder) Reset

func (b *FilterBuilder) Reset()

type FilterBuilderObject

type FilterBuilderObject map[string]interface{}

func Eq

func Eq[T comparable](value T) FilterBuilderObject

func Ge added in v0.0.5

func Ge[T cmp.Ordered](value T) FilterBuilderObject

func Gt added in v0.0.5

func Gt[T cmp.Ordered](value T) FilterBuilderObject

func Le added in v0.0.5

func Le[T cmp.Ordered](value T) FilterBuilderObject

func Lt added in v0.0.5

func Lt[T cmp.Ordered](value T) FilterBuilderObject

func Ne

func Ne[T comparable](value T) FilterBuilderObject

func NumberIn

func NumberIn[T comparable](value []T) FilterBuilderObject

func NumberRange

func NumberRange[T comparable](value []T) FilterBuilderObject

func Regex

func Regex(value string) FilterBuilderObject

func StringIn

func StringIn(value []string) FilterBuilderObject

func StringRange added in v0.0.5

func StringRange(value []string) FilterBuilderObject

type IFilterBuilder

type IFilterBuilder interface {
	// Or And must be placed before any other method call, and only one of them can be called, at most once.
	Or() IFilterBuilder
	And() IFilterBuilder
	// KStringV KBoolV KNumberV are used to build `$eq` filters of corresponding data types.
	KStringV(key string, value string) IFilterBuilder
	KBoolV(key string, value bool) IFilterBuilder
	KNumberV(key string, value float64) IFilterBuilder
	// KObjectV is used to build filters other than `$eq`.
	KObjectV(key string, value FilterBuilderObject) IFilterBuilder
	// Build is usually placed at the end of the chaining method calls and returns the filter string. It is reentrant.
	Build() string
	// Reset is used to clean all the filters in the `IFilterBuilder` if you need to build another filter string.
	Reset()
}

Jump to

Keyboard shortcuts

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