Represents the collections included in a read.
Public inputs are normalized before they reach query code:
:allincludes every collection- a collection name includes only that collection
- a list of names includes those collections
- an empty list matches no collections
Collection names must be non-empty binaries. Normalization preserves their order while removing duplicates.
Summary
Functions
Reads a collection scope from keyword options.
Reads and normalizes a collection scope from options or raises ArgumentError.
Returns the intersection of two normalized collection scopes.
Normalizes a public collection scope.
Normalizes a collection scope or raises ArgumentError.
Returns whether every collection in scope is included in allowed.
Types
Functions
@spec from_opts( keyword(), input() ) :: {:ok, t()} | {:error, error_reason()}
Reads a collection scope from keyword options.
The :collection option accepts every public scope shape. When it is absent,
default is normalized instead. The removed :collections alias is rejected
so an outdated scoped caller cannot silently widen to the default.
Reads and normalizes a collection scope from options or raises ArgumentError.
Returns the intersection of two normalized collection scopes.
When both scopes list names, their order follows the first scope.
@spec normalize(term()) :: {:ok, t()} | {:error, error_reason()}
Normalizes a public collection scope.
Returns {:error, {:invalid_collection_scope, input}} when a name is blank
or an input has an unsupported shape.
Normalizes a collection scope or raises ArgumentError.
Returns whether every collection in scope is included in allowed.
This is useful at authorization boundaries where silently intersecting an explicit request would accept only part of a forged scope.