mango

package
v0.0.0-...-c54dfb2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: AGPL-3.0 Imports: 2 Imported by: 4 modules, 20 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxString = string(unicode.MaxRune)

MaxString is the unicode character \uFFFF, useful as an upperbound for queryies

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	json.Marshaler
	ToMango() Map
}

A Filter is a filter on documents, to be passed as the selector of a couchdb.FindRequest In the future, we might add go-side validation but we will need to duplicate the couchdb UCA algorithm

func And

func And(filters ...Filter) Filter

And returns a filter combining several filters

func Between

func Between(field string, v1 interface{}, v2 interface{}) Filter

Between returns a filter that check if v1 <= field < v2

func Equal

func Equal(field string, value interface{}) Filter

Equal returns a filter that check if a field == value

func Exists

func Exists(field string) Filter

Exists returns a filter that check that the document has this field

func Gt

func Gt(field string, value interface{}) Filter

Gt returns a filter that check if a field > value

func Gte

func Gte(field string, value interface{}) Filter

Gte returns a filter that check if a field >= value

func In

func In(field string, values []interface{}) Filter

In returns a filter that checks if the field is equal to one of the values

func Lt

func Lt(field string, value interface{}) Filter

Lt returns a filter that check if a field < value

func Lte

func Lte(field string, value interface{}) Filter

Lte returns a filter that check if a field <= value

func Nor

func Nor(filters ...Filter) Filter

Nor returns a filter combining several filters

func Not

func Not(filter Filter) Filter

Not returns a filter inversing another filter

func NotEqual

func NotEqual(field string, value interface{}) Filter

NotEqual returns a filter that check if a field != value

func NotExists

func NotExists(field string) Filter

NotExists returns a filter that check that the document does not have this field

func Or

func Or(filters ...Filter) Filter

Or returns a filter combining several filters

func StartWith

func StartWith(field string, prefix string) Filter

StartWith returns a filter that check if field's string value start with prefix

type Index

type Index struct {
	Doctype string
	Request *IndexRequest
}

Index contains an index request on a specified domain.

func MakeIndex

func MakeIndex(doctype, name string, def IndexDef) *Index

MakeIndex constructs a new Index it lets couchdb defaults for index & designdoc names.

type IndexDef

type IndexDef struct {
	Fields        []string `json:"fields"`
	PartialFilter Filter   `json:"partial_filter_selector,omitempty"`
}

An IndexDef is a list of fields to be indexed and an optional partial filter for complex and costly requests.

type IndexRequest

type IndexRequest struct {
	Name  string   `json:"name,omitempty"`
	DDoc  string   `json:"ddoc,omitempty"`
	Index IndexDef `json:"index"`
}

IndexRequest is a request to be POSTED to create the index

type LogicOperator

type LogicOperator string

LogicOperator is an operator between two filters

type Map

type Map map[string]interface{}

Map is an alias for map[string]interface{}

func (Map) MarshalJSON

func (m Map) MarshalJSON() ([]byte, error)

MarshalJSON returns a byte json representation of the map

func (Map) ToMango

func (m Map) ToMango() Map

ToMango implements the Filter interface on Map it returns the map itself

type SortBy

type SortBy []SortByField

SortBy is a sorting rule to be used as the sort of a couchdb.FindRequest a list of (field, direction) combination.

func (SortBy) MarshalJSON

func (s SortBy) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaller on SortBy it will returns a json array [field, direction]

type SortByField

type SortByField struct {
	Field     string
	Direction SortDirection
}

SortByField is a sorting rule to be used as the sort for a pair of (field, direction).

type SortDirection

type SortDirection string

SortDirection can be either ASC or DESC

const Asc SortDirection = "asc"

Asc is the ascending sorting order

const Desc SortDirection = "desc"

Desc is the descending sorting order

type ValueOperator

type ValueOperator string

ValueOperator is an operator between a field and a value

Jump to

Keyboard shortcuts

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