expr

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2017 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package expr encapsulates operations of aggregation framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a interface{}, b interface{}) bson.M

Add encapsulates MongoDB operation $add.

func And

func And(items ...interface{}) bson.M

And encapsulates MongoDB operation $and

func Ceil

func Ceil(input interface{}) bson.M

Ceil encapsulates MongoDB operation $ceil.

func CeilDateSeconds

func CeilDateSeconds(step interface{}) bson.M

CeilDateSeconds rounds up seconds to whole seconds, minutes, hours, days.

func CeilIn24System

func CeilIn24System(input interface{}) bson.M

CeilIn24System - 1, 2, 3, 6, 12, 24

func CeilIn60System

func CeilIn60System(input interface{}) bson.M

CeilIn60System - 1, 2, 5, 10, 15, 30, 60

func CeilWithStep

func CeilWithStep(input interface{}, step interface{}) bson.M

CeilWithStep - ceil value with given step.

func Concat

func Concat(parts ...interface{}) bson.M

Concat encapsulates MongoDB operation $concat.

func ConcatArrays

func ConcatArrays(arrays ...interface{}) bson.M

ConcatArrays encapsulates MongoDB operation $concatArrays.

func Cond

func Cond(cond interface{}, t interface{}, f interface{}) bson.M

Cond encapsulates MongoDB operation $cond.

func DateInTimezone

func DateInTimezone(date interface{}, timezone *helpers.Timezone) interface{}

DateInTimezone converts date in UTC timezone to desired timezone

func DateToTimestamp

func DateToTimestamp(date interface{}) bson.M

DateToTimestamp converts date to timestamp in DB.

func DayOfMonth

func DayOfMonth(el interface{}) bson.M

DayOfMonth encapsulates MongoDB operation $dayOfMonth.

func DayOfWeek

func DayOfWeek(el interface{}) bson.M

DayOfWeek encapsulates MongoDB operation $dayOfWeek.

func DayOfYear

func DayOfYear(el interface{}) bson.M

DayOfYear encapsulates MongoDB operation $dayOfYear.

func Divide

func Divide(a interface{}, b interface{}) bson.M

Divide encapsulates MongoDB operation $divide.

func Eq

func Eq(a interface{}, b interface{}) bson.M

Eq encapsulates MongoDB operation $eq.

func Facet

func Facet() *facet

Facet encapsulates MongoDB operation $facet.

func Field

func Field(name ...string) string

Field - document field shorthand

func FirstDayOfMonth

func FirstDayOfMonth(yearDate interface{}, month int) interface{}

FirstDayOfMonth converts date to first day of given month. The year remains unchanged.

func Floor

func Floor(input interface{}) bson.M

Floor encapsulates MongoDB operation $floor.

func FloorWithStep

func FloorWithStep(input interface{}, step interface{}) bson.M

FloorWithStep - floor value with given step.

func Gt

func Gt(a interface{}, b interface{}) bson.M

Gt encapsulates MongoDB operation $gt.

func Gte

func Gte(a interface{}, b interface{}) bson.M

Gte encapsulates MongoDB operation $gte.

func Hour

func Hour(el interface{}) bson.M

Hour encapsulates MongoDB operation $hour.

func In

func In(el interface{}, array interface{}) bson.M

In encapsulates MongoDB operation $in.

func Let

func Let(vars bson.M, in interface{}) bson.M

Let encapsulates MongoDB operation $let.

func Log10

func Log10(a interface{}) bson.M

Log10 encapsulates MongoDB operation $log10.

func Lt

func Lt(a interface{}, b interface{}) bson.M

Lt encapsulates MongoDB operation $lt.

func Lte

func Lte(a interface{}, b interface{}) bson.M

Lte encapsulates MongoDB operation $lte.

func Map

func Map(input interface{}, as interface{}, in interface{}) bson.M

Map encapsulates MongoDB operation $map.

func MergeObjects

func MergeObjects(objects interface{}) bson.M

MergeObjects encapsulates MongoDB operation $mergeObjects.

func Mod

func Mod(a interface{}, b interface{}) bson.M

Mod encapsulates MongoDB operation $mod.

func Month

func Month(el interface{}) bson.M

Month encapsulates MongoDB operation $month.

func Multiply

func Multiply(a interface{}, b interface{}) bson.M

Multiply encapsulates MongoDB operation $multiply.

func Ne

func Ne(a interface{}, b interface{}) bson.M

Ne encapsulates MongoDB operation $ne.

func NthSundayOfMonth

func NthSundayOfMonth(date interface{}, n int, numberOfDays int) bson.M

NthSundayOfMonth get date of N-th sunday of month

func ObjectToArray

func ObjectToArray(obj interface{}) bson.M

ObjectToArray encapsulates MongoDB operation $objectToArray.

func Or

func Or(items ...interface{}) bson.M

Or encapsulates MongoDB operation $or.

func Pow

func Pow(a interface{}, e interface{}) bson.M

Pow encapsulates MongoDB operation $pow.

func Pow10

func Pow10(e interface{}) bson.M

Pow10 encapsulates MongoDB operation $pow.

func ResetMonthDay

func ResetMonthDay(date interface{}) bson.M

ResetMonthDay converts date to date of the fist day of month

func Size

func Size(array interface{}) bson.M

Size encapsulates MongoDB operation $size.

func Slice

func Slice(array interface{}, length interface{}) bson.M

Slice encapsulates MongoDB operation $slice.

func Subtract

func Subtract(a interface{}, b interface{}) bson.M

Subtract encapsulates MongoDB operation $subtract.

func Switch

func Switch() *sw

Switch encapsulates MongoDB operation $switch.

func TimestampToDate

func TimestampToDate(timestamp interface{}) bson.M

TimestampToDate converts timestamp to date in DB.

func Type

func Type(el interface{}) bson.M

Type encapsulates MongoDB operation $type.

func Var

func Var(name ...string) string

Var - local variable

func Year

func Year(el interface{}) bson.M

Year encapsulates MongoDB operation $year.

Types

type Pipeline

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

Pipeline represents stages of aggregation pipeline in MongoDB.

func NewPipeline

func NewPipeline() *Pipeline

NewPipeline creates new Pipeline.

func (*Pipeline) AddStage

func (p *Pipeline) AddStage(op string, spec interface{})

AddStage to Pipeline.

func (*Pipeline) AddStages

func (p *Pipeline) AddStages(stages ...bson.M)

AddStages to Pipeline.

func (*Pipeline) GetPipe

func (p *Pipeline) GetPipe(c *mgo.Collection) *mgo.Pipe

GetPipe gets MongoDB aggregation pipe.

func (*Pipeline) GetStages

func (p *Pipeline) GetStages() []bson.M

GetStages from pipeline.

func (*Pipeline) Iter

func (p *Pipeline) Iter(c *mgo.Collection, batchSize int) *mgo.Iter

Iter - gets iterator over Pipeline results.

func (*Pipeline) ToBsonChannel

func (p *Pipeline) ToBsonChannel(c *mgo.Collection, outCh chan<- bson.M, concurrency int, bufferSize int, batchSize int)

ToBsonChannel - gets pipeline results as BSON channel.

func (*Pipeline) ToRawChannel

func (p *Pipeline) ToRawChannel(c *mgo.Collection, outCh chan<- []byte, concurrency int, bufferSize int, batchSize int)

ToRawChannel - gets pipeline results as raw ([]byte) channel.

Jump to

Keyboard shortcuts

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