Documentation

Overview

Package firestore is an auto-generated package for the Cloud Firestore API.

Accesses the NoSQL document database built for automatic scaling, high performance, and ease of application development.

NOTE: This package is in beta. It is not stable, and may be subject to changes.

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit godoc.org/cloud.google.com/go.

Deprecated: Please use "cloud.google.com/go/firestore/apiv1". This beta client will be removed in a future release.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

    DefaultAuthScopes reports the default set of authentication scopes to use with this package.

    Types

    type CallOptions

    type CallOptions struct {
    	GetDocument       []gax.CallOption
    	ListDocuments     []gax.CallOption
    	CreateDocument    []gax.CallOption
    	UpdateDocument    []gax.CallOption
    	DeleteDocument    []gax.CallOption
    	BatchGetDocuments []gax.CallOption
    	BeginTransaction  []gax.CallOption
    	Commit            []gax.CallOption
    	Rollback          []gax.CallOption
    	RunQuery          []gax.CallOption
    	Write             []gax.CallOption
    	Listen            []gax.CallOption
    	ListCollectionIds []gax.CallOption
    }

      CallOptions contains the retry settings for each method of Client.

      type Client

      type Client struct {
      
      	// The call options for this service.
      	CallOptions *CallOptions
      	// contains filtered or unexported fields
      }

        Client is a client for interacting with Cloud Firestore API.

        Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

        func NewClient

        func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

          NewClient creates a new firestore client.

          The Cloud Firestore service.

          This service exposes several types of comparable timestamps:

          create_time - The time at which a document was created. Changes only
          when a document is deleted, then re-created. Increases in a strict
          monotonic fashion.
          
          update_time - The time at which a document was last updated. Changes
          every time a document is modified. Does not change when a write results
          in no modifications. Increases in a strict monotonic fashion.
          
          read_time - The time at which a particular state was observed. Used
          to denote a consistent snapshot of the database or the time at which a
          Document was observed to not exist.
          
          commit_time - The time at which the writes in a transaction were
          committed. Any read with an equal or greater read_time is guaranteed
          to see the effects of the transaction.
          
          Example
          Output:
          
          

          func (*Client) BatchGetDocuments

            BatchGetDocuments gets multiple documents.

            Documents returned by this method are not guaranteed to be returned in the same order that they were requested.

            func (*Client) BeginTransaction

              BeginTransaction starts a new transaction.

              Example
              Output:
              
              

              func (*Client) Close

              func (c *Client) Close() error

                Close closes the connection to the API service. The user should invoke this when the client is no longer required.

                func (*Client) Commit

                  Commit commits a transaction, while optionally updating documents.

                  Example
                  Output:
                  
                  

                  func (*Client) Connection

                  func (c *Client) Connection() *grpc.ClientConn

                    Connection returns a connection to the API service.

                    Deprecated.

                    func (*Client) CreateDocument

                    func (c *Client) CreateDocument(ctx context.Context, req *firestorepb.CreateDocumentRequest, opts ...gax.CallOption) (*firestorepb.Document, error)

                      CreateDocument creates a new document.

                      Example
                      Output:
                      
                      

                      func (*Client) DeleteDocument

                      func (c *Client) DeleteDocument(ctx context.Context, req *firestorepb.DeleteDocumentRequest, opts ...gax.CallOption) error

                        DeleteDocument deletes a document.

                        Example
                        Output:
                        
                        

                        func (*Client) GetDocument

                          GetDocument gets a single document.

                          Example
                          Output:
                          
                          

                          func (*Client) ListCollectionIds

                          func (c *Client) ListCollectionIds(ctx context.Context, req *firestorepb.ListCollectionIdsRequest, opts ...gax.CallOption) *StringIterator

                            ListCollectionIds lists all the collection IDs underneath a document.

                            Example
                            Output:
                            
                            

                            func (*Client) ListDocuments

                            func (c *Client) ListDocuments(ctx context.Context, req *firestorepb.ListDocumentsRequest, opts ...gax.CallOption) *DocumentIterator

                              ListDocuments lists documents.

                              Example
                              Output:
                              
                              

                              func (*Client) Listen

                                Listen listens to changes.

                                Example
                                Output:
                                
                                

                                func (*Client) Rollback

                                func (c *Client) Rollback(ctx context.Context, req *firestorepb.RollbackRequest, opts ...gax.CallOption) error

                                  Rollback rolls back a transaction.

                                  Example
                                  Output:
                                  
                                  

                                  func (*Client) RunQuery

                                    RunQuery runs a query.

                                    func (*Client) SetGoogleClientInfo

                                    func (c *Client) SetGoogleClientInfo(keyval ...string)

                                      SetGoogleClientInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Also passes any provided key-value pairs. Intended for use by Google-written clients.

                                      Internal use only.

                                      func (*Client) UpdateDocument

                                      func (c *Client) UpdateDocument(ctx context.Context, req *firestorepb.UpdateDocumentRequest, opts ...gax.CallOption) (*firestorepb.Document, error)

                                        UpdateDocument updates or inserts a document.

                                        Example
                                        Output:
                                        
                                        

                                        func (*Client) Write

                                          Write streams batches of document updates and deletes, in order.

                                          Example
                                          Output:
                                          
                                          

                                          type DocumentIterator

                                          type DocumentIterator struct {
                                          
                                          	// Response is the raw response for the current page.
                                          	// It must be cast to the RPC response type.
                                          	// Calling Next() or InternalFetch() updates this value.
                                          	Response interface{}
                                          
                                          	// InternalFetch is for use by the Google Cloud Libraries only.
                                          	// It is not part of the stable interface of this package.
                                          	//
                                          	// InternalFetch returns results from a single call to the underlying RPC.
                                          	// The number of results is no greater than pageSize.
                                          	// If there are no more results, nextPageToken is empty and err is nil.
                                          	InternalFetch func(pageSize int, pageToken string) (results []*firestorepb.Document, nextPageToken string, err error)
                                          	// contains filtered or unexported fields
                                          }

                                            DocumentIterator manages a stream of *firestorepb.Document.

                                            func (*DocumentIterator) Next

                                            func (it *DocumentIterator) Next() (*firestorepb.Document, error)

                                              Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

                                              func (*DocumentIterator) PageInfo

                                              func (it *DocumentIterator) PageInfo() *iterator.PageInfo

                                                PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

                                                type StringIterator

                                                type StringIterator struct {
                                                
                                                	// Response is the raw response for the current page.
                                                	// It must be cast to the RPC response type.
                                                	// Calling Next() or InternalFetch() updates this value.
                                                	Response interface{}
                                                
                                                	// InternalFetch is for use by the Google Cloud Libraries only.
                                                	// It is not part of the stable interface of this package.
                                                	//
                                                	// InternalFetch returns results from a single call to the underlying RPC.
                                                	// The number of results is no greater than pageSize.
                                                	// If there are no more results, nextPageToken is empty and err is nil.
                                                	InternalFetch func(pageSize int, pageToken string) (results []string, nextPageToken string, err error)
                                                	// contains filtered or unexported fields
                                                }

                                                  StringIterator manages a stream of string.

                                                  func (*StringIterator) Next

                                                  func (it *StringIterator) Next() (string, error)

                                                    Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

                                                    func (*StringIterator) PageInfo

                                                    func (it *StringIterator) PageInfo() *iterator.PageInfo

                                                      PageInfo supports pagination. See the google.golang.org/api/iterator package for details.