Go - Collection.Collection()

Get a query-only sub-collection reference, this can be used to query commonly named collections across documents.

import (
"fmt"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
profiles, err := nitric.NewCollection("profiles").With(nitric.CollectionReading)
if err != nil {
return
}
enemies := profiles.Collection("enemies")
nitric.Run()
}

Parameters

  • Name
    name
    Required
    Required
    Type
    string
    Description

    The name of the sub-collection to reference

Examples

Create a query for a sub collection

import (
"fmt"
"github.com/nitrictech/go-sdk/nitric"
)
func main() {
profiles, err := nitric.NewCollection("profiles").With(nitric.CollectionReading)
if err != nil {
return
}
enemies := profiles.Collection("enemies")
enemiesQuery := enemies.Query()
nitric.Run()
}

See also

Last updated on Dec 5, 2024