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

Function Example_openCollectionFromURL

docstore/memdocstore/example_test.go:60–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58}
59
60func Example_openCollectionFromURL() {
61 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
62 // PRAGMA: On gocloud.dev, add a blank import: _ "gocloud.dev/docstore/memdocstore"
63 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
64 ctx := context.Background()
65
66 // docstore.OpenCollection creates a *docstore.Collection from a URL.
67 coll, err := docstore.OpenCollection(ctx, "mem://collection/keyField")
68 if err != nil {
69 log.Fatal(err)
70 }
71 defer coll.Close()
72 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
73 // Output:
74}

Callers

nothing calls this directly

Calls 2

OpenCollectionFunction · 0.92
CloseMethod · 0.65

Tested by

no test coverage detected