roll

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

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 8 Imported by: 0

README

roll

Resourceful Operations Language Layer

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolRender

func BoolRender(b *Bool) string

func GetAgg

func GetAgg(name string, m map[string]any) []any

func GetAggAsStrings

func GetAggAsStrings(name string, m map[string]any) []string

func GetAggLogic

func GetAggLogic(name string, m map[string]any) []any

func Many

func Many(index, field, value string) []map[string]any

func SingleId

func SingleId(index, id string) map[string]any

func SingleUpsert

func SingleUpsert(index, id string, m map[string]any)

Types

type Agg

type Agg struct {
	Name   string
	Field  string
	Source string
	Size   int
}

func NewAgg

func NewAgg(name, field string) *Agg

func (*Agg) Render

func (a *Agg) Render() string

type Bool

type Bool struct {
	Musts    []*Item
	MustNots []*Item
	Shoulds  []*Item
}

func NewBool

func NewBool() *Bool

func (*Bool) AddMust

func (b *Bool) AddMust(field, op, value string)

func (*Bool) AddMustBool

func (b *Bool) AddMustBool(b1 *Bool)

func (*Bool) AddMustNot

func (b *Bool) AddMustNot(field, op, value string)

func (*Bool) AddShould

func (b *Bool) AddShould(field, op, value string)

func (*Bool) AddShouldBool

func (b *Bool) AddShouldBool(b1 *Bool)

type BoolProvider

type BoolProvider interface {
	GetBools() []*Bool
	Render() string
}

type Item

type Item struct {
	Bool      *Bool
	Operation *Operation
}

func NewItem

func NewItem(b *Bool, o *Operation) *Item

type ItemProvider

type ItemProvider interface {
	Render() string
}

type Operation

type Operation struct {
	Field string
	Op    string
	Value string
}

func NewOperation

func NewOperation(field, op, value string) *Operation

func (*Operation) Render

func (o *Operation) Render() string

type Query

type Query struct {
	Bool    *Bool
	Size    int
	Source  []string
	Aggs    []*Agg
	Sort    []*Sort
	Offset  int
	UseFrom bool
}

func NewQuery

func NewQuery(b *Bool) *Query

func (*Query) AddAgg

func (q *Query) AddAgg(a *Agg)

func (*Query) Render

func (q *Query) Render() string

type Roll

type Roll struct {
	Fields    []string
	IndexName string
	Username  string
	Password  string
	Host      string
}

func NewRoll

func NewRoll(s string) *Roll

func (*Roll) Exec

func (r *Roll) Exec() []map[string]any

func (*Roll) ExtractHits

func (r *Roll) ExtractHits(m map[string]any) []map[string]any

func (*Roll) ExtractHitsNeed

func (r *Roll) ExtractHitsNeed(m map[string]any, need int) []map[string]any

func (*Roll) ExtractHitsWithout

func (r *Roll) ExtractHitsWithout(m map[string]any, dupMap map[string]bool) []map[string]any

func (*Roll) GetAgg

func (r *Roll) GetAgg(name string, m map[string]any) []any

func (*Roll) GetAggAsStrings

func (r *Roll) GetAggAsStrings(name string, m map[string]any) []string

func (*Roll) MakeNetworkPost

func (r *Roll) MakeNetworkPost(jsonString string) map[string]any

func (*Roll) MakeNetworkPut

func (r *Roll) MakeNetworkPut(id, jsonString string) map[string]any

func (*Roll) NewAgg

func (r *Roll) NewAgg(name, field string) *Agg

func (*Roll) NewBool

func (r *Roll) NewBool() *Bool

func (*Roll) NewQuery

func (r *Roll) NewQuery(b *Bool) *Query

type Sort

type Sort struct {
	Field     string
	Direction string
	Lat       string
	Lon       string
}

func DescSort

func DescSort(list string) []*Sort

func DistanceSort

func DistanceSort(lat, lon string) []*Sort

func NewSort

func NewSort(f, d string) *Sort

func (*Sort) Render

func (s *Sort) Render() string

type Upsert

type Upsert struct {
	Id     string
	Params map[string]any
}

func NewUpsert

func NewUpsert(id string, params map[string]any) *Upsert

func (*Upsert) Render

func (u *Upsert) Render() string

Jump to

Keyboard shortcuts

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