Documentation
¶
Index ¶
- Variables
- func CommonBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, ...) (bson.D, error)
- func EqualBSONFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, ...) (bson.D, error)
- func ExistsBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, ...) (bson.D, error)
- func InBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, ...) (bson.D, error)
- func IsNullBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, ...) (bson.D, error)
- func StringBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, ...) (bson.D, error)
- type BSONizer
- type BSONizerFunc
- type Operator
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidOperatorMapped = errors.New("Invalid operator mapped for the BSONizerFunc")
)
Errors for the basic functions
var (
ErrNoBSONOperator = errors.New("No BSON operator found")
)
Err`ors used in the filter bsonizers
Functions ¶
func CommonBSONizerFunc ¶
func CommonBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, fv *filters.OperatorValuePair) (bson.D, error)
CommonBSONizerFunc is the BSONizerFunc used for multiple filter operators
func EqualBSONFunc ¶
func EqualBSONFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, fv *filters.OperatorValuePair) (bson.D, error)
EqualBSONFunc is the func that gets the filter bson.E for given scope and filter values
func ExistsBSONizerFunc ¶
func ExistsBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, fv *filters.OperatorValuePair) (bson.D, error)
ExistsBSONizerFunc is the BSONizerFunc that checks if the given field exists in the given collection
func InBSONizerFunc ¶
func InBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, fv *filters.OperatorValuePair) (bson.D, error)
InBSONizerFunc is the BSONizerFunc that handles $in and $notin operators
func IsNullBSONizerFunc ¶
func IsNullBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, fv *filters.OperatorValuePair) (bson.D, error)
IsNullBSONizerFunc is the BSONizerFunc for the ISNULL and NotNull operators
func StringBSONizerFunc ¶
func StringBSONizerFunc(b *BSONizer, s *query.Scope, field *mapping.StructField, fv *filters.OperatorValuePair) (bson.D, error)
StringBSONizerFunc is the function that checks if the given
Types ¶
type BSONizer ¶
type BSONizer struct {
// contains filtered or unexported fields
}
BSONizer is the struct that creates the bson.D for the given scope's filters
func NewBSONizer ¶
NewBSONizer creates new BSONizer with the provided operators
func (*BSONizer) ParseFilters ¶
ParseFilters parses the query filters into bson.D
func (*BSONizer) RegisterOperator ¶
RegisterOperator registers the BSONizer Operator
type BSONizerFunc ¶
type BSONizerFunc func(*BSONizer, *query.Scope, *mapping.StructField, *filters.OperatorValuePair) (bson.D, error)
BSONizerFunc is the function that parses the scope's filter into bson.D
type Operator ¶
type Operator struct {
O *filters.Operator
Func BSONizerFunc
Raw string
}
Operator is the filters.Operator wrapper that contains BSONizerFunc and a raw mongo string value
func NewOperator ¶
func NewOperator(o *filters.Operator, bFunc BSONizerFunc, raw ...string) Operator
NewOperator creates new filters operator