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())
nitric.Run()
}

Parameters

  • Name
    ctx
    Required
    Required
    Type
    context
    Description

    The context of the call, used for tracing.

See also

Last updated on Dec 19, 2024