I am trying to use Firestore as my backend to store document data. The response from Firestore to
docs, _ := q.Documents(ctx).GetAll()
is of type
var docs []*firestore.DocumentSnapshot
Assuming my document has the struture
map[array:[a b] text:bla]
How can I access the values in the *firestore.DocumentSnapshot
?
I see a result when
for _, doc := range docs {
fmt.Println(doc.Data())
}
get's executed and it prints
map[array:[a b] text:bla]
func g() {
ctx := context.Background()
client, _ := firestore.NewClient(ctx, "myapp")
defer client.Close()
q := client.Collection("my").
Limit(10)
docs, _ := q.Documents(ctx).GetAll()
for _, doc := range docs {
fmt.Println(doc.Data())
}
}
I would like to use the values in a http template in my application in a slice of struct.