query

package
v0.0.0-...-449281a Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2015 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ASC  = 1
	DESC = -1
)

Variables

This section is empty.

Functions

func CollapseField

func CollapseField(in interface{}, out interface{})

func DeepAssign

func DeepAssign(d RawExpr, value interface{}, keys ...string)

func Variablize

func Variablize(fields ...string) string

Types

type Arel

type Arel struct {
	*ArelNodes
}

func NewArel

func NewArel() *Arel

func (*Arel) Average

func (this *Arel) Average(target string) *Arel

func (*Arel) Collect

func (this *Arel) Collect(target string) *Arel

func (*Arel) Count

func (this *Arel) Count() *Arel

func (*Arel) CountUnique

func (this *Arel) CountUnique(target string) *Arel

func (*Arel) GroupBy

func (this *Arel) GroupBy(groups ...string) *Arel

func (*Arel) GroupByGiven

func (this *Arel) GroupByGiven() bool

func (*Arel) Limit

func (this *Arel) Limit(n int) *Arel

func (*Arel) Max

func (this *Arel) Max(target string) *Arel

func (*Arel) Min

func (this *Arel) Min(target string) *Arel

func (*Arel) OrderBy

func (this *Arel) OrderBy(orders ...*Order) *Arel

func (*Arel) Pipeline

func (this *Arel) Pipeline() *Pipeline

func (*Arel) Select

func (this *Arel) Select(fields ...string) *Arel

func (*Arel) SelectUnique

func (this *Arel) SelectUnique(target string) *Arel

func (*Arel) Sum

func (this *Arel) Sum(target string) *Arel

func (*Arel) Where

func (this *Arel) Where(conds ...*Condition) *Arel

type ArelNodes

type ArelNodes struct {
	Select  *Select
	Where   *Where
	GroupBy *GroupBy
	OrderBy *OrderBy
	Limit   *Limit
}

type Average

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

func (*Average) Visit

func (this *Average) Visit(v *Visitor, g *GroupBy)

type Collect

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

func (*Collect) Visit

func (this *Collect) Visit(v *Visitor, g *GroupBy)

type Condition

type Condition struct {
	Field string
	Op    string
	Value interface{}
}

func NewCondition

func NewCondition(field string, op string, value interface{}) *Condition

func (*Condition) OpExpr

func (this *Condition) OpExpr() RawExpr

func (*Condition) RawExpr

func (this *Condition) RawExpr() RawExpr

type Count

type Count struct{}

func (*Count) Visit

func (this *Count) Visit(v *Visitor, g *GroupBy)

type CountUnique

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

func (*CountUnique) Visit

func (this *CountUnique) Visit(v *Visitor, g *GroupBy)

type Group

type Group []string

func (Group) RawExpr

func (this Group) RawExpr() RawExpr

type GroupBy

type GroupBy struct {
	Group Group
	Op    Operator
}

func NewGroupBy

func NewGroupBy() *GroupBy

func (*GroupBy) AddGroup

func (this *GroupBy) AddGroup(groups ...string) *GroupBy

func (*GroupBy) SetOp

func (this *GroupBy) SetOp(op Operator) *GroupBy

func (*GroupBy) Visit

func (this *GroupBy) Visit(v *Visitor, arel *Arel)

type Limit

type Limit struct {
	N int
}

func NewLimit

func NewLimit() *Limit

func (*Limit) Visit

func (this *Limit) Visit(v *Visitor, arel *Arel)

type Max

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

func (*Max) Visit

func (this *Max) Visit(v *Visitor, g *GroupBy)

type Min

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

func (*Min) Visit

func (this *Min) Visit(v *Visitor, g *GroupBy)

type NoOp

type NoOp struct {
	Fields []string
}

func (*NoOp) Visit

func (this *NoOp) Visit(v *Visitor, g *GroupBy)

type Operator

type Operator interface {
	Visit(*Visitor, *GroupBy)
}

type Order

type Order struct {
	Field string
	Order int
}

type OrderBy

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

func NewOrderBy

func NewOrderBy() *OrderBy

func (*OrderBy) AddOrder

func (this *OrderBy) AddOrder(orders ...*Order) *OrderBy

func (*OrderBy) Visit

func (this *OrderBy) Visit(v *Visitor, arel *Arel)

type Pipeline

type Pipeline []Stage

func (*Pipeline) Append

func (this *Pipeline) Append(stages ...Stage) *Pipeline

type Query

type Query struct {
	Arel *Arel
	// contains filtered or unexported fields
}

func New

func New(c *mgo.Collection, arel *Arel) *Query

func (*Query) Execute

func (this *Query) Execute(result interface{}) error

type RawExpr

type RawExpr map[string]interface{}

func ExpandField

func ExpandField(doc RawExpr) RawExpr

type Select

type Select struct {
	Fields []string
}

func NewSelect

func NewSelect() *Select

func (*Select) AddField

func (this *Select) AddField(fields ...string) *Select

func (*Select) Visit

func (this *Select) Visit(v *Visitor, arel *Arel)

type SelectUnique

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

func (*SelectUnique) Visit

func (this *SelectUnique) Visit(v *Visitor, g *GroupBy)

type Stage

type Stage RawExpr

type Sum

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

func (*Sum) Visit

func (this *Sum) Visit(v *Visitor, g *GroupBy)

type Visitor

type Visitor struct {
	Arel     *Arel
	Pipeline Pipeline
}

func NewVisitor

func NewVisitor(arel *Arel) *Visitor

func (*Visitor) Collect

func (this *Visitor) Collect(stages ...Stage) *Visitor

type Where

type Where struct {
	Conditions map[string]*Condition
}

func NewWhere

func NewWhere() *Where

func (*Where) Condition

func (this *Where) Condition(conds ...*Condition) *Where

func (*Where) Visit

func (this *Where) Visit(v *Visitor, arel *Arel)

Jump to

Keyboard shortcuts

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