Tools that make it easier to work with Google Cloud / Firebase's Firestore.
For instance:
ob := &MyObject{}
err := firetils.Save(ctx, client, "myCollection", ob) // depending on interfaces on the object, it will update timestamps, call PreSave() function, etc
Fetching:
There's several functions here, they will all call populate into a struct and call AfterLoad().
firetils.GetByID
firetils.GetOneByQuery
firetils.GetAllByQuery
Add TimeStamped and Firestored to your objects, eg:
type X struct {
firetils.Firestored
firetils.TimeStamped
firetils.IDed
}
You can do pre-saving and after-loading by adding PreSave(ctx context.Context)
and/or AfterLoad(ctx context.Context)
function to your models.
Authenticate
function will validate an auth token.
Or use firetils.FireAuth
middleware to do it automatically.