-
Notifications
You must be signed in to change notification settings - Fork 0
/
wrappers.go
28 lines (21 loc) · 1.03 KB
/
wrappers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package dalgo2firestore
import (
"cloud.google.com/go/firestore"
"context"
)
var deleteByDocRef = func(ctx context.Context, docRef *firestore.DocumentRef) (result *firestore.WriteResult, err error) {
return docRef.Delete(ctx)
}
type createFunc func(ctx context.Context, docRef *firestore.DocumentRef, data interface{}) (result *firestore.WriteResult, err error)
var createNonTransactional = func(ctx context.Context, docRef *firestore.DocumentRef, data interface{}) (result *firestore.WriteResult, err error) {
return docRef.Create(ctx, data)
}
var set = func(ctx context.Context, docRef *firestore.DocumentRef, data interface{}) (result *firestore.WriteResult, err error) {
return docRef.Set(ctx, data)
}
var get = func(ctx context.Context, docRef *firestore.DocumentRef) (result *firestore.DocumentSnapshot, err error) {
return docRef.Get(ctx)
}
//var getAll = func(ctx context.Context, client *firestore.Client, docRefs []*firestore.DocumentRef) (_ []*firestore.DocumentSnapshot, err error) {
// return client.GetAll(ctx, docRefs)
//}