Documentation
¶
Index ¶
- type FS
- type FirebaseClient
- func (f *FirebaseClient) DeleteDocument(collection string, document string) error
- func (f *FirebaseClient) GetAllDocuments(collection string, filter string, value string) ([]map[string]interface{}, error)
- func (f *FirebaseClient) GetDocument(collection string, document string) (map[string]interface{}, error)
- func (f *FirebaseClient) InsertDocument(collection string, data map[string]interface{}) error
- func (f *FirebaseClient) UpsertDocument(collection string, document string, data map[string]interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FirebaseClient ¶
type FirebaseClient struct {
// contains filtered or unexported fields
}
FirebaseClient is a wrapper around the firebase.App client.
func NewFirebaseClient ¶
func NewFirebaseClient(ctx context.Context, projectID string, secretsJSON []byte) (*FirebaseClient, error)
NewFirebaseClient creates a new Firebase client with the provided project ID and secrets JSON. It initializes the Firebase app using the given context, project ID, and secrets JSON. Returns a pointer to the created FirebaseClient and any error encountered during initialization.
func (*FirebaseClient) DeleteDocument ¶
func (f *FirebaseClient) DeleteDocument(collection string, document string) error
DeleteDocument deletes a document from the specified collection in Firestore. It takes the collection name and document ID as parameters. Returns an error if there was a problem deleting the document.
func (*FirebaseClient) GetAllDocuments ¶
func (f *FirebaseClient) GetAllDocuments(collection string, filter string, value string) ([]map[string]interface{}, error)
GetAllDocuments with Filter
func (*FirebaseClient) GetDocument ¶
func (f *FirebaseClient) GetDocument(collection string, document string) (map[string]interface{}, error)
GetDocument retrieves a document from a specified collection in Firestore. It takes the collection name and document ID as parameters and returns the document data as a map[string]interface{} and an error, if any.
func (*FirebaseClient) InsertDocument ¶
func (f *FirebaseClient) InsertDocument(collection string, data map[string]interface{}) error
func (*FirebaseClient) UpsertDocument ¶
func (f *FirebaseClient) UpsertDocument(collection string, document string, data map[string]interface{}) error
UpsertDocument inserts or updates a document in the specified collection with the provided data. If the document already exists, it will be updated with the new data. If it doesn't exist, a new document will be created. The function returns an error if there was a problem with the Firestore operation.