lib

package
v0.0.0-...-f5b5bba Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2019 License: MIT Imports: 5 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 {
	// contains filtered or unexported fields
}

Client is used to access to Firestore documents

func NewClient

func NewClient(ctx context.Context, config *ClientConfig) (*Client, error)

NewClient returns a Client to operate data on Firestore

func (*Client) Add

func (c *Client) Add(ctx context.Context, collection string, document map[string]interface{}) (*Doc, error)

Add a document into a collection

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, collection string, docID string) error

Delete a document from a collection

func (*Client) Get

func (c *Client) Get(ctx context.Context, collection string, docID string) (*Doc, error)

Get returns a document by docID

func (*Client) Query

func (c *Client) Query(ctx context.Context, collection string, conditions []*Condition, limit int) ([]*Doc, error)

Query returns documents matched with conditions and limit the results

type ClientConfig

type ClientConfig struct {
	Credentials string
	ProjectID   string
}

ClientConfig is a configuration to use Firestore Client

type Condition

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

Condition is used for Firesstore query

type Doc

type Doc struct {
	// contains filtered or unexported fields
}

Doc represents documentation of Firestore

func (*Doc) String

func (d *Doc) String() string

String returns JSON string of documentation

Jump to

Keyboard shortcuts

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