modules

package
v0.0.0-...-829097c Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

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

func NewFS

func NewFS(credentialsFilePath string, defaultTransferTimeout time.Duration) (*FS, error)

func (*FS) Upload

func (fs *FS) Upload(fileInput []byte, bucketName, fileName string) error

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.

Jump to

Keyboard shortcuts

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