builder

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package builder help us to write aggregate,filter,update maps simpler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func S

func S(operators ...Operator) bson.M

S get operators as param and return bson.M to using result as filter,stage,...

Types

type BaseOperator

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

BaseOperator is simple base operator that implemented Operator.

func (*BaseOperator) GetKey

func (operator *BaseOperator) GetKey() string

GetKey function return operator's key.

func (*BaseOperator) GetVal

func (operator *BaseOperator) GetVal() interface{}

GetVal method return operator's value.

type Operator

type Operator interface {
	GetKey() string
	GetVal() interface{}
}

Operator is interface that should implement by each struct that want to be an operator.

func Bucket

func Bucket(groupBy, boundaries, def, output interface{}) Operator

Bucket function return mongo $bucket operator to using in aggregates.

func BucketAuto

func BucketAuto(groupBy, buckets, output, granularity interface{}) Operator

BucketAuto function return mongo $bucketAuto operator to using in aggregates.

func CollStats

func CollStats(latencyStats, storageStats, count interface{}) Operator

CollStats function return mongo $collStats operator to using in aggregates.

func CurrentOp

func CurrentOp(allUsers, idleConnections, idleCursors, idleSessions, localOps interface{}) Operator

CurrentOp function return mongo $currentOp operator to using in aggregates.

func Group

func Group(ID interface{}, params bson.M) Operator

Group function return mongo $group operator to using in aggregates.

func Lookup

func Lookup(from, localField, foreignField, as interface{}) Operator

Lookup function return mongo $lookup operator to using in aggregates.

func Merge

func Merge(into, on, let, whenMatched, whenNotMatched interface{}) Operator

Merge function return mongo $merge operator to using in aggregates.

func New

func New(key string, val interface{}) Operator

New function return new Operator

func ReplaceRoot

func ReplaceRoot(newRoot interface{}) Operator

ReplaceRoot function return mongo $replaceRoot operator to using in aggregates.

func Sample

func Sample(size interface{}) Operator

Sample function return mongo sample operator to using in aggregates.

func UncorrelatedLookup

func UncorrelatedLookup(from, let, pipeline, as interface{}) Operator

UncorrelatedLookup function return mongo $lookup operator to using in aggregates.

func Unwind

func Unwind(path, includeArrayIndex, preserveNullAndEmptyArrays interface{}) Operator

Unwind function return mongo $unwind operator to using in aggregates.

type SMap

type SMap struct {
	Operators []Operator
}

SMap is simple map that can be substitute of `bson.M` to having simpler map structure on query,aggregate,...

func (*SMap) ToMap

func (s *SMap) ToMap() bson.M

ToMap function convert our Simple map to bson.M to using in filters,stages,...

Jump to

Keyboard shortcuts

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