documents

package
v0.9.0-rc.19 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxCollectionDepth int = 1

Variables

This section is empty.

Functions

func BoolValue

func BoolValue(val bool) *value

func Condition

func Condition(field string) *queryExpressionBuilder

func DoubleValue

func DoubleValue(val float64) *value

DoubleValue - Create a DoubleValue for a Query

func NumberValue

func NumberValue(val int) *value

NumberValue - Create a NumberValue for a Query

func StringValue

func StringValue(val string) *value

StringValue - Create a StringValue for a Query

Types

type CollectionGroupRef added in v0.7.1

type CollectionGroupRef interface {
	// Query - Create a query for this collection group reference
	Query() Query

	// Parent - Get the parent collection of this collection group reference
	Parent() CollectionGroupRef

	// Name - Get the name of this collection group reference
	Name() string
}

CollectionGroupRef - A reference to a chain of collections not tied to document keys for building sub collection queries

type CollectionRef

type CollectionRef interface {
	Name() string
	Doc(string) DocumentRef
	Query() Query
	Parent() DocumentRef
	Collection(string) CollectionGroupRef
	ToWire() *v1.Collection
}

Collection

type DecodeOption

type DecodeOption interface {
	Apply(c *mapstructure.DecoderConfig)
}

type Document

type Document interface {
	// Ref - Retrieve the original DocumentRef for this document
	Ref() DocumentRef
	// Content - Retrieve the documents content as a Map
	Content() map[string]interface{}
	// Decode - Decode document content into the given reference
	Decode(interface{}, ...DecodeOption) error
}

Document - Interface for interacing with document API results

type DocumentIter

type DocumentIter interface {
	// Next - Retrieve the next document in the iterator
	Next() (Document, error)
}

DocumentIter - An iterator for lazy document retrieval

type DocumentRef

type DocumentRef interface {
	Parent() CollectionRef

	Id() string

	// Get - Retrieve the value of the document
	Get() (Document, error)

	// Set - Sets the value of the document
	Set(map[string]interface{}) error

	// Delete - Deletes the document
	Delete() error

	// Collection - Retrieve a child collection of this document
	Collection(string) (CollectionRef, error)
	// contains filtered or unexported methods
}

DocumentRef - Represents a reference to a document

type Documents

type Documents interface {
	// Collection - Create a new collection reference
	Collection(string) CollectionRef
}

Documents

func New

func New() (Documents, error)

type FetchResult

type FetchResult struct {
	Documents   []Document
	PagingToken interface{}
}

type Query

type Query interface {
	// Where - Append one or more expressions to the query
	Where(...*queryExpression) Query

	// Limit - limit the max result size of the query
	Limit(int) Query
	// FromPagingToken - Start from a given entry
	FromPagingToken(interface{}) Query

	// Fetch - Return paged values
	Fetch() (*FetchResult, error)

	// Stream - Return an iterator containing values
	Stream() (DocumentIter, error)
}

Query - Query interface for Document Service

Jump to

Keyboard shortcuts

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