MCPcopy Create free account
hub / github.com/google/go-cloud / Example_openCollectionFromURL

Function Example_openCollectionFromURL

docstore/gcpfirestore/example_test.go:79–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77}
78
79func Example_openCollectionFromURL() {
80 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
81 // PRAGMA: On gocloud.dev, add a blank import: _ "gocloud.dev/docstore/gcpfirestore"
82 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
83 ctx := context.Background()
84
85 // docstore.OpenCollection creates a *docstore.Collection from a URL.
86 const url = "firestore://projects/my-project/databases/(default)/documents/my-collection?name_field=userID"
87 coll, err := docstore.OpenCollection(ctx, url)
88 if err != nil {
89 log.Fatal(err)
90 }
91 defer coll.Close()
92}

Callers

nothing calls this directly

Calls 2

OpenCollectionFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected