document

package
v0.12.0-rc.21 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MaxSubCollectionDepth int = 1

MaxSubCollectionDepth - maximum number of parents a collection can support. Depth is a count of the number of parents for a collection. e.g. a collection with no parent has a depth of 0 a collection with a parent has a depth of 1

Variables

This section is empty.

Functions

func GetEndRangeValue

func GetEndRangeValue(value string) string

GetEndRangeValue - Get end range value to implement "startsWith" expression operator using where clause. For example with sdk.Expression("pk", "startsWith", "Customer#") this translates to: WHERE pk >= {startRangeValue} AND pk < {endRangeValue} WHERE pk >= "Customer#" AND pk < "Customer!"

func ValidateCollection

func ValidateCollection(collection *Collection) error

ValidateCollection - validates a collection key, used for operations on a single document/collection e.g. Get, Set, Delete

func ValidateExpressions

func ValidateExpressions(expressions []QueryExpression) error

ValidateExpressions - Validate the provided query expressions

func ValidateKey

func ValidateKey(key *Key) error

ValidateKey - validates a document key, used for operations on a single document e.g. Get, Set, Delete

func ValidateQueryCollection

func ValidateQueryCollection(collection *Collection) error

ValidateQueryCollection - Validates a collection used for query operations. unique from ValidateCollection in that it calls ValidateQueryKey for the collection.Key

func ValidateQueryKey

func ValidateQueryKey(key *Key) error

ValidateQueryKey - Validates a key used for query operations. unique from ValidateKey in that it permits blank key.Id values for wildcard query scenarios. e.g. querying values in a sub-collection for all documents in the parent collection.

Types

type Collection added in v0.4.2

type Collection struct {
	Name   string `log:"Name"`
	Parent *Key   `log:"Parent"`
}

type Document added in v0.4.2

type Document struct {
	Key     *Key
	Content map[string]interface{}
}

type DocumentIterator added in v0.10.0

type DocumentIterator = func() (*Document, error)

type DocumentService added in v0.4.2

type DocumentService interface {
	Get(*Key) (*Document, error)
	Set(*Key, map[string]interface{}) error
	Delete(*Key) error
	Query(*Collection, []QueryExpression, int, map[string]string) (*QueryResult, error)
	QueryStream(*Collection, []QueryExpression, int) DocumentIterator
}

The base Document Plugin interface Use this over proto definitions to remove dependency on protobuf in the plugin internally and open options to adding additional non-grpc interfaces

type ExpsSort

type ExpsSort []QueryExpression

func (ExpsSort) Len

func (exps ExpsSort) Len() int

func (ExpsSort) Less

func (exps ExpsSort) Less(i, j int) bool

Less - Sort by Operand then Operator then Value

func (ExpsSort) Swap

func (exps ExpsSort) Swap(i, j int)

type Key added in v0.4.2

type Key struct {
	Collection *Collection `log:"Collection"`
	Id         string      `log:"Id"`
}

type QueryExpression added in v0.4.2

type QueryExpression struct {
	Operand  string
	Operator string
	Value    interface{}
}

type QueryResult added in v0.4.2

type QueryResult struct {
	Documents   []Document
	PagingToken map[string]string
}

type UnimplementedDocumentPlugin added in v0.4.2

type UnimplementedDocumentPlugin struct {
	DocumentService
}

func (*UnimplementedDocumentPlugin) Delete added in v0.4.2

func (p *UnimplementedDocumentPlugin) Delete(key *Key) error

func (*UnimplementedDocumentPlugin) Get added in v0.4.2

func (p *UnimplementedDocumentPlugin) Get(key *Key) (*Document, error)

func (*UnimplementedDocumentPlugin) Query added in v0.4.2

func (p *UnimplementedDocumentPlugin) Query(collection *Collection, expressions []QueryExpression, limit int, pagingToken map[string]string) (*QueryResult, error)

func (*UnimplementedDocumentPlugin) QueryStream added in v0.10.0

func (p *UnimplementedDocumentPlugin) QueryStream(collection *Collection, expressions []QueryExpression, limit int) DocumentIterator

func (*UnimplementedDocumentPlugin) Set added in v0.4.2

func (p *UnimplementedDocumentPlugin) Set(key *Key, content map[string]interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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