https://github.com/apinet/gcloud-firestore
Firestore (gcloud) wrapper with mocking capabilities
https://github.com/apinet/gcloud-firestore
Last synced: about 1 month ago
JSON representation
Firestore (gcloud) wrapper with mocking capabilities
- Host: GitHub
- URL: https://github.com/apinet/gcloud-firestore
- Owner: apinet
- Created: 2021-11-26T18:14:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-25T13:52:27.000Z (about 3 years ago)
- Last Synced: 2025-01-10T00:46:09.072Z (over 1 year ago)
- Language: Go
- Size: 25.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gcloud-firestore
Firestore (gcloud) wrapper with mocking capabilities for golang cloud functions.
## usage
### initiate store
```go
import (
store "github.com/apinet/gcloud-firestore"
)
s := store.NewStore("project-id")
```
### document operations
```go
leffe := Leffe{}
found, err := s.Collection("beer").Doc("leffe").Get(&leffe)
err := s.Collection("beer").Doc("leffe").Set(&leffe)
err := s.Collection("beer").Doc("leffe").Update(patch)
err := s.Collection("beer").Doc("leffe").Delete()
```
### batch operations
```go
batch := s.Batch()
batch.Set(doc1Ref, &leffe)
batch.Update(doc2Ref, &patch)
err := batch.Commit()
```