Go is in development for v1. Interested in contributing or chatting with us?Get in touch!
Go - Collection.Doc.Get()
Retrieve the value of a document.
import (
"context"
"fmt"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
profiles, err := nitric.NewCollection("profiles").With(nitric.CollectionReading)
if err != nil {
return
}
drakeProfileRef := profiles.Doc("Drake Mallard")
doc, err := drakeProfileRef.Get(context.TODO())
if err != nil {
return
}
fmt.Println(doc.Content())
if err := nitric.Run(); err != nil {
fmt.Println(err)
}
}
Parameters
- Name
ctx
- Required
- Required
- Type
- context
- Description
The context of the call, used for tracing.