Debian Codegraph @

firestore/examples/end2end/src/apimethods/listdocuments.go

raw
1 package apimethods
2
3 import (
4 "context"
5 "fmt"
6 "fsutils"
7 firestore "go-genproto/googleapis/firestore/v1beta1"
8 "userutil"
9 )
10
11 //ListDocuments ... List all Documents from a Database
12 func ListDocuments() {
13 fmt.Println("\n:: Listing All Documents ::\n")
14
15 client, conn := fsutils.MakeFSClient()
16
17 defer conn.Close()
18
19 listDocsRequest := firestore.ListDocumentsRequest{
20 Parent: "projects/firestoretestclient/databases/(default)",
21 }
22
23 //bgd_client, err := client.BatchGetDocuments(context.Background(), &getDocsRequest, grpc.FailFast(true))
24 resp, err := client.ListDocuments(context.Background(), &listDocsRequest)
25 if err != nil {
26 fmt.Println(err)
27 }
28 for _, doc := range resp.Documents {
29 userutil.DrawDocument(*doc)
30 }
31
32 return
33 }