firestore

package
v0.0.0-...-e9fe98c Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Firestore *firestore.Client
	Ctx       context.Context
}

Client wraps the Firestore client.

func (Client) AddDoc

func (c Client) AddDoc(collection string, data interface{}) error

AddDoc creates a Firestore document.

func (Client) Authenticated

func (c Client) Authenticated() bool

Authenticated returns true if client is authenticated.

func (Client) Close

func (c Client) Close() error

Close the Firestore client.

func (Client) DeleteDoc

func (c Client) DeleteDoc(path string) error

DeleteDoc deletes a Firestore document.

func (Client) GetDoc

func (c Client) GetDoc(path string) map[string]interface{}

GetDoc gets a Firestore document.

func (Client) QueryItems

func (c Client) QueryItems(
	collection string,
	conditions []Condition,
	ordering []Order,
	limit int,
	updateFunc UpdateFunc,
) ([]interface{}, error)

QueryItems queries the Firestore database.

func (Client) SetDoc

func (c Client) SetDoc(path string, data map[string]interface{}) error

SetDoc writes a Firestore document.

type ClientInterface

type ClientInterface interface {
	GetDoc(path string) map[string]interface{}
	SetDoc(path string, data map[string]interface{}) error
	AddDoc(collection string, data interface{}) error
	Authenticated() bool
	Close() error
	QueryItems(collection string, conditions []Condition, ordering []Order, limit int, updateFunc UpdateFunc) ([]interface{}, error)
	DeleteDoc(path string) error
}

ClientInterface is the Firestore client interface.

type Condition

type Condition struct {
	Path     string
	Operator string
	Value    interface{}
}

Condition describes a Query condition.

type Order

type Order struct {
	Field     string
	Direction string
}

Order describes a Query order.

type UpdateFunc

type UpdateFunc func(data map[string]interface{}) (map[string]interface{}, error)

UpdateFunc describes a method signature for an update function.

Jump to

Keyboard shortcuts

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