Go is in development for v1. Interested in contributing or chatting with us?Get in touch!
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")
  if err := nitric.Run(); err != nil {
    fmt.Println(err)
  }
}
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()
  if err := nitric.Run(); err != nil {
    fmt.Println(err)
  }
}