esgen

package
v0.0.0-...-fc2d520 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MatchAll = &matchall{&struct{}{}}

MatchAll maps to the Elasticsearch "match_all" filter

View Source
var MatchNone = NotFilter(MatchAll)

MatchNone matches no documents.

View Source
var (
	// MaxDepth specifies the depth at which we are certain the filter generator is in an endless loop
	// This *shouldn't* happen, but is better than a stack overflow
	MaxDepth = 1000
)

Functions

func DayBucket

func DayBucket(dt time.Time) int

copy-pasta from entity to avoid the import when we actually parameterize this we will need to do it differently anyway

func Exists

func Exists(field *gentypes.FieldType) interface{}

Exists creates a new Elasticsearch filter {"exists": {"field": field}}

func In

func In(field *gentypes.FieldType, values []interface{}) interface{}

In creates a new Elasticsearch terms filter

{"terms": {field: values}}

{ "nested": {
     "query": {
        "bool" : {
           "must" :[
              {"term": { "k":fieldName}},
              filter,
           ]
     } ,
     "path":"path_to_obj"
 }}

func Nested

func Nested(field *gentypes.FieldType, filter interface{}) *nested

Nested creates a new Elasticsearch nested filter

{ "nested": {
     "query": {
        "bool" : {
           "must" :[
              {"term": { "k":fieldName}},
              filter,
           ]
     } ,
     "path":"path_to_obj"
 }}

func Term

func Term(fieldName string, value interface{}) *term

Term creates a new Elasticsearch term filter {"term": {field: value}}

func Wildcard

func Wildcard(field, value string) *wildcard

Wilcard creates a new Elasticserach wildcard query

{"wildcard": {field: value}}

nested

{"nested": {
   "filter" : { "and" : [
           {"wildcard": {"v": value}},
           {"term":{"k": field_key}}
   "path": path
  }
}

Types

type BoolFilter

type BoolFilter struct {
	Occurs         BoolOccurrence `json:"bool"`
	MinShouldMatch int            `json:"minimum_should_match,omitempty"`
}

func AndFilter

func AndFilter(v []interface{}) *BoolFilter

func NotFilter

func NotFilter(v interface{}) *BoolFilter

func OrFilter

func OrFilter(v []interface{}) *BoolFilter

type BoolOccurrence

type BoolOccurrence struct {
	Filter  []interface{} `json:"filter,omitempty"`
	Should  []interface{} `json:"should,omitempty"`
	MustNot interface{}   `json:"must_not,omitempty"`
}

type FilterGenerator

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

func (*FilterGenerator) Walk

type NestedQuery

type NestedQuery struct {
	Query interface{} `json:"query"`
	Path  string      `json:"path"`
}

type RangeFilter

type RangeFilter struct {
	Range map[string]RangeQry `json:"range"`
}

type RangeQry

type RangeQry struct {
	GTE interface{} `json:"gte,omitempty"`
	LTE interface{} `json:"lte,omitempty"`
	GT  interface{} `json:"gt,omitempty"`
	LT  interface{} `json:"lt,omitempty"`
}

type TypeValidator

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

func NewValidator

func NewValidator(s gentypes.SchemaColumns) *TypeValidator

func (*TypeValidator) FilterValidate

func (m *TypeValidator) FilterValidate(stmt *rel.FilterStatement) error

Jump to

Keyboard shortcuts

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