query

package
v0.0.0-...-f36bde2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AndQuery

type AndQuery struct {
	And []WhereQuery `json:"and"`
}

type GroupByQueryItem

type GroupByQueryItem struct {
	Column string `json:"column"`
	Depth  int    `json:"depth"`
}

type OrQuery

type OrQuery struct {
	Or []WhereQuery `json:"or"`
}

type Query

type Query struct {
	UserId       string             `json:"_userId"`
	Interval     time.Duration      `json:"interval"`
	SelectFields []SelectQueryItem  `json:"select"`
	WhereQuery   WhereQuery         `json:"where"`
	GroupByQuery []GroupByQueryItem `json:"groupBy"`
}

func Get

func Get(body []byte) (*Query, error)

func (*Query) GetBytes

func (q *Query) GetBytes() ([]byte, error)

type SelectQueryItem

type SelectQueryItem struct {
	Column    string `json:"column"`
	Operation string `json:"operation"`
	As        string `json:"as"`
}

*

{
	"column": "PaymentAmount",
	"operation": "sum",
	"as": "PaymentAmountSum"
}

type TerminalQuery

type TerminalQuery struct {
	Column    string `json:"column"`
	Operation string `json:"operation"`
	Value     string `json:"value"`
}

type WhereQuery

type WhereQuery struct {
	TerminalQuery
	AndQuery
	OrQuery
}

Where -> T | And | Or

	 And -> Where*
  Or -> Where*

func (*WhereQuery) Eval

func (w *WhereQuery) Eval(data map[string]string) bool

func (*WhereQuery) GetColumnListFromQuery

func (w *WhereQuery) GetColumnListFromQuery(list *[][]string)

func (*WhereQuery) Validate

func (w *WhereQuery) Validate() error

Jump to

Keyboard shortcuts

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