Documentation ¶
Index ¶
- func ApplyToCollection(ctx context.Context, collectionName string, filterFunc Filter, ...) (bool, error)
- func CreateFirestoreClientFromConfig(ctx context.Context) (*firestore.Client, error)
- func FilterCollectionDocs(ctx context.Context, collectionName string, filterFunc Filter) ([]*firestore.DocumentSnapshot, error)
- func TransformCollectionDocs(ctx context.Context, collectionName string, transformFunc Transform) (bool, error)
- func WriteCollectionToJSON(ctx context.Context, collectionName string) (bool, error)
- func WriteJSONtoCollection(ctx context.Context, jsonPath string, collectionName string) (bool, error)
- func WriteToFirestore(ctx context.Context, data []map[string]interface{}, collectionName string, ...) (bool, error)
- type Filter
- type Transform
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyToCollection ¶
func ApplyToCollection(ctx context.Context, collectionName string, filterFunc Filter, transformFunc Transform) (bool, error)
ApplyToCollection applies Filter function to each doc, if true then applies Transform to the doc
func CreateFirestoreClientFromConfig ¶
CreateFirestoreClientFromConfig creates a firestore client from config
func FilterCollectionDocs ¶
func FilterCollectionDocs(ctx context.Context, collectionName string, filterFunc Filter) ([]*firestore.DocumentSnapshot, error)
FilterCollectionDocs applies a Filter func to all the docs and returns the array of filtered ones
func TransformCollectionDocs ¶
func TransformCollectionDocs(ctx context.Context, collectionName string, transformFunc Transform) (bool, error)
TransformCollectionDocs applies Transform function to each doc of the collection
func WriteCollectionToJSON ¶
WriteCollectionToJSON write a collection as json with same name as collection
func WriteJSONtoCollection ¶
func WriteJSONtoCollection(ctx context.Context, jsonPath string, collectionName string) (bool, error)
WriteJSONtoCollection reads a json file and writes to collection
func WriteToFirestore ¶
func WriteToFirestore(ctx context.Context, data []map[string]interface{}, collectionName string, docIDFieldName string) (bool, error)
WriteToFirestore takes data as map[string]interface{} and writes to Firestore collection Will replace any doc if ID in the data already present in Firestore
Types ¶
type Filter ¶
type Filter func(snapshot *firestore.DocumentSnapshot) bool
Click to show internal directories.
Click to hide internal directories.