Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustParseQuery ¶
func MustParseQuery(query string, keyValues ...interface{}) interface{}
MustParseQuery creates bson request from specified JSON and parameters. Same as ParseQuery but panics if there was an error during parsing JSON..
func ParseQuery ¶
ParseQuery creates bson document from specified JSON and specified parameters.ParseQuery uses internal cache so query will be decoded only once, and then cached values will be used.
Types ¶
type MarshalledQuery ¶
type MarshalledQuery struct {
// contains filtered or unexported fields
}
func MarshalQuery ¶
func MarshalQuery(query interface{}, params ...interface{}) (MarshalledQuery, error)
MarshalQuery creates serialized representation of query or pipeline.
func NewMarshalledQuery ¶ added in v0.2.0
func NewMarshalledQuery(bsonData *bytes.Buffer) MarshalledQuery
func (MarshalledQuery) Close ¶
func (q MarshalledQuery) Close() error
Close returns marshal buffer to internal pool and returns nil.
func (MarshalledQuery) MarshalBSON ¶
func (q MarshalledQuery) MarshalBSON() ([]byte, error)
MarshalBSON just returns marshalled bson document.
func (MarshalledQuery) MarshalBSONValue ¶ added in v0.2.0
func (q MarshalledQuery) MarshalBSONValue() (bsontype.Type, []byte, error)
MarshalBSONValue returns marshalled bson document as bson value. We use bson array here because it is the only type that can be used as pipeline.
type QueryEncoder ¶
type QueryEncoder struct {
// contains filtered or unexported fields
}
func NewQueryEncoder ¶
func NewQueryEncoder(params map[string]interface{}) QueryEncoder
func (QueryEncoder) EncodePipeline ¶
func (enc QueryEncoder) EncodePipeline(ec bsoncodec.EncodeContext, vw bsonrw.ValueWriter, val reflect.Value) error
func (QueryEncoder) EncodeValue ¶
func (enc QueryEncoder) EncodeValue(ec bsoncodec.EncodeContext, vw bsonrw.ValueWriter, val reflect.Value) error