mu

package module
v0.0.0-...-efe27ae Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: GPL-3.0 Imports: 4 Imported by: 8

README

mu

Collection of mongo utils for aggregation pipelines

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APAddFields

func APAddFields(what interface{}) interface{}

APAddFields return a addFields stage

func APCount

func APCount(field string) interface{}

APCount return a count stage

func APFacet

func APFacet(fields interface{}) interface{}

APFacet return a facet stage

func APGroup

func APGroup(fields interface{}) interface{}

APGroup return a group stage

func APGroupAndCountStages

func APGroupAndCountStages(whatFieldName string, countFieldName string, what interface{}) interface{}

APGroupAndCountStages return some aggregation stagess that group whatFieldName by what and count the documents

func APLimit

func APLimit(number interface{}) interface{}

APLimit return a limit stage

func APLookupPipeline

func APLookupPipeline(from string, let interface{}, as string, pipeline interface{}) interface{}

APLookupPipeline return a lookup stage

func APLookupSimple

func APLookupSimple(from string, localField string, foreignField string, as string) interface{}

APLookupSimple return a lookup stage

func APMatch

func APMatch(conditions interface{}) interface{}

APMatch return a match stage

func APOAdd

func APOAdd(things ...interface{}) interface{}

APOAdd return a expression that sum the things

func APOAnd

func APOAnd(conds ...interface{}) interface{}

APOAnd return a expresison that return true if all conds are true

func APOAny

func APOAny(input interface{}, itemName string, cond interface{}) interface{}

APOAny return a expression that return true if any element in input satisfy the cond (in the cond the variable this can be used to refer to the current item of the array)

func APOArrayElemAt

func APOArrayElemAt(input interface{}, index interface{}) interface{}

APOArrayElemAt return a expression that return the element from the array input with the index index

func APOCeil

func APOCeil(what interface{}) interface{}

APOCeil return a expression that return ceil(what)

func APOConcat

func APOConcat(what ...interface{}) interface{}

APOConcat return a expression that return the concatenation of what

func APOCond

func APOCond(cond interface{}, ifTrue interface{}, ifFalse interface{}) interface{}

APOCond return a expression that return ifTrue if cond is true, otherwise ifFalse

func APOConvert

func APOConvert(input interface{}, to string) interface{}

APOConvert return a expression that convert input to to

func APOConvertErrorable

func APOConvertErrorable(input interface{}, to string, onError interface{}) interface{}

APOConvertErrorable return a expression that convert input to to

func APOConvertErrorableNullable

func APOConvertErrorableNullable(input interface{}, to string, onError interface{}, onNull interface{}) interface{}

APOConvertErrorableNullable return a expression that convert input to to

func APOConvertNullable

func APOConvertNullable(input interface{}, to string, onNull interface{}) interface{}

APOConvertNullable return a expression that convert input to to

func APOConvertToDoubleOrZero

func APOConvertToDoubleOrZero(what interface{}) interface{}

APOConvertToDoubleOrZero return a expression that convert what to double if it's valid or return zero if invalid or null

func APODateFromNullableString

func APODateFromNullableString(what interface{}, format string, onNull interface{}) interface{}

APODateFromNullableString return a expression that parse the what into a date

func APODateFromString

func APODateFromString(what interface{}, format string) interface{}

APODateFromString return a expression that parse the what into a date

func APODivide

func APODivide(a interface{}, b interface{}) interface{}

APODivide return a expression that divide a by b

func APOEqual

func APOEqual(a interface{}, b interface{}) interface{}

APOEqual return a expression that return true if a and b are equal, otherwise false

func APOFilter

func APOFilter(input interface{}, as string, cond interface{}) interface{}

APOFilter return a expression that return a filtered array of values by cond from input

func APOFloor

func APOFloor(what interface{}) interface{}

APOFloor return a expression that return floor(what)

func APOGetCaptureFromRegexMatch

func APOGetCaptureFromRegexMatch(input interface{}, regex string, options string, captureIndex int) interface{}

APOGetCaptureFromRegexMatch return a capture group from a regex match of given input and regex

func APOGreater

func APOGreater(a interface{}, b interface{}) interface{}

APOGreater return a expression that return true if a is greater than b

func APOGreaterOrEqual

func APOGreaterOrEqual(a interface{}, b interface{}) interface{}

APOGreaterOrEqual return a expression that return true if a is greater or equal than b

func APOIfNull

func APOIfNull(what interface{}, altValue interface{}) interface{}

APOIfNull return a expression that return what if not null, otherwise altValue

func APOIndexOfCp

func APOIndexOfCp(what interface{}, subString interface{}) interface{}

APOIndexOfCp return a expression that split the string what using sep as separator

func APOJoin

func APOJoin(list interface{}, sep interface{}) interface{}

APOJoin return a expression that join the list into a string

func APOLet

func APOLet(vars interface{}, in interface{}) interface{}

APOLet return a expression that calculate the vars and use it in the in expression

func APOMap

func APOMap(input interface{}, as string, in interface{}) interface{}

APOMap return a expression that return a array of mapped value from input to in

func APOMax

func APOMax(what ...interface{}) interface{}

APOMin return a expression that return the max of what

func APOMaxAggr

func APOMaxAggr(what interface{}) interface{}

APOMaxAggr return a maximizing expression of whats

func APOMaxWithCmpExpr

func APOMaxWithCmpExpr(cmpExprA interface{}, cmpExprB interface{}, a interface{}, b interface{}) interface{}

APOMaxWithCmpExpr return a expression that return the maximium between a and b using the cmpExpressions

func APOMergeObjects

func APOMergeObjects(what ...interface{}) interface{}

APOMergeObjects return a expression that return a merge of what

func APOMin

func APOMin(what ...interface{}) interface{}

APOMin return a expression that return the min of what

func APONotEqual

func APONotEqual(a interface{}, b interface{}) interface{}

APONotEqual return a expression that return true if a and b are inequal, otherwise false

func APOOr

func APOOr(conds ...interface{}) interface{}

APOOr return a expresison that return true if any conds are true

func APOPush

func APOPush(what interface{}) interface{}

APOPush return a pushing expression of whats

func APOReduce

func APOReduce(input interface{}, initialValue interface{}, in interface{}) interface{}

APOReduce return a expression that reduce the input array into a value

func APORegexFind

func APORegexFind(input interface{}, regex string, options string) interface{}

APORegexFind return a expression that return a regex match

func APOSetUnion

func APOSetUnion(what ...interface{}) interface{}

APOSetUnion return a expression that return a set that contains every elements in what

func APOSize

func APOSize(input interface{}) interface{}

APOSize return a expression that return the size of input

func APOSplit

func APOSplit(what interface{}, sep interface{}) interface{}

APOSplit return a expression that split the string what using sep as separator

func APOStrLenCP

func APOStrLenCP(what interface{}) interface{}

APOStrLenCP return a expression that return the length of the string what

func APOSubstrCP

func APOSubstrCP(what interface{}, start interface{}, len interface{}) interface{}

APOSubstrCP return a expression that return the substring of the string what

func APOSubtract

func APOSubtract(a interface{}, b interface{}) interface{}

APOSubtract return a expression that subtract a-b

func APOSum

func APOSum(what interface{}) interface{}

APOSum return a summing expression of whats

func APOSumReducer

func APOSumReducer(input interface{}, expr interface{}) interface{}

APOSumReducer return a expression that return the sum of every expr applied to each argument of input $$this contains the current item

func APOToDouble

func APOToDouble(input interface{}) interface{}

APOToDouble return a expression that convert input to double

func APOTrim

func APOTrim(what interface{}) interface{}

APOTrim return a expression that trim the string what

func APOptionalPagingStage

func APOptionalPagingStage(page int, size int) interface{}

APOptionalPagingStage return a stage that turn a stream of documents into a page that contains the documents plus some metadata

func APOptionalSortingStage

func APOptionalSortingStage(sortBy string, sortDesc bool) interface{}

APOptionalSortingStage return a stage that sort documents by the criteria in the params

func APOptionalStage

func APOptionalStage(optional bool, stage interface{}) interface{}

APOptionalStage return the stage if optional is true, otherwise return a null stage

func APProject

func APProject(what interface{}) interface{}

APProject return a project stage

func APReplaceWith

func APReplaceWith(what interface{}) interface{}

APReplaceWith return a replaceWith stage

func APSearchFilterStage

func APSearchFilterStage(fields []interface{}, keywords []string) interface{}

APSearchFilterStage return a aggregation stage that filter the documents when any field match any keyword

func APSet

func APSet(what interface{}) interface{}

APSet return a set stage

func APSkip

func APSkip(number interface{}) interface{}

APSkip return a skip stage

func APSort

func APSort(what interface{}) interface{}

APSort return a sort stage

func APUnset

func APUnset(what ...interface{}) interface{}

APUnset return a unset stage

func APUnwind

func APUnwind(what string) interface{}

APUnwind return a unwind stage

func BsonOptionalExtension

func BsonOptionalExtension(extend bool, orig bson.M, extension bson.M) bson.M

BsonOptionalExtension return a bson with the same key-values pairs as the orig and extension, if extend is true, otherwise return the orig bson

func MAPipeline

func MAPipeline(stages ...interface{}) bson.A

MAPipeline return a aggregation pipeline joining the stages that could be a single stage or a slice of multiple stages

func QOExpr

func QOExpr(value interface{}) interface{}

QOExpr return the expr operator

func QOLessThan

func QOLessThan(value interface{}) interface{}

QOLessThan return a less than condition

func QOLessThanOrEqual

func QOLessThanOrEqual(value interface{}) interface{}

QOLessThanOrEqual return a less than or equal condition

func QONotEqual

func QONotEqual(value interface{}) interface{}

QONotEqual return a not equal condition

func QOSize

func QOSize(value interface{}) interface{}

QOSize return the size operator

func UOSet

func UOSet(value interface{}) interface{}

QOSize return the size operator

Types

This section is empty.

Jump to

Keyboard shortcuts

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