bsonbuilder

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsComparable

func IsComparable(val interface{}) bool

IsComparable returns true if a val is comparable.

func IsDateTime

func IsDateTime(val interface{}) bool

IsDateTime returns true if a val is datetime.

func IsNumeric

func IsNumeric(val interface{}) bool

IsNumeric returns true if a val is numeric.

func IsObjectID

func IsObjectID(val interface{}) bool

IsObjectID returns true if a val is ObjectID.

func IsString

func IsString(val interface{}) bool

IsString returns true if a val is string.

func Max

func Max(vals []interface{}) interface{}

Max returns the maximum value in vals if each elements in vals is comparable, otherwise returns nil.

func Min

func Min(vals []interface{}) interface{}

Min returns the minimum value in vals if each elements in vals is comparable, otherwise returns nil.

func Sort

func Sort(vals []interface{}) []interface{}

Sort sorts returns a sorted vals in ascending order if comparable, otherwise returns nil.

Types

type Operator

type Operator int

Operator represents the query operation.

const (
	OperatorEq Operator = iota
	OperatorNe
	OperatorGt
	OperatorGte
	OperatorLt
	OperatorLte
	OperatorLike
	OperatorExists
)

func (Operator) ToBSON

func (op Operator) ToBSON(vals ...interface{}) bson.M

ToBSON converts operator to bson.

type Query

type Query interface {
	Add(key string, op Operator, val ...interface{})
	ToBSON() bson.M
}

Query can describe a query through the fields, operators and conditions.

func New

func New() Query

New instances a new Query object.

Jump to

Keyboard shortcuts

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