Go - Collection.Query.Limit()

Limit the number of results returned by a query.

import (
  "fmt"

  "github.com/nitrictech/go-sdk/nitric"
)

func main() {
  profiles, err := nitric.NewCollection("profiles").With(nitric.CollectionReading, nitric.CollectionWriting, nitric.CollectionDeleting)
  if err != nil {
    return
  }

  profilesQuery := profiles.Query().Limit(10)

  if err := nitric.Run(); err != nil {
    fmt.Println(err)
  }
}

Parameters

  • Name
    limit
    Required
    Required
    Type
    int
    Description

    The limit to apply to the query.

See also