Compiles structured Elixir Pull patterns into canonical xitdb Pull syntax strings.
Examples
iex> Xitdb.Pull.compile!([:username, :age, todos: 0..2, profile: [:city]])
"{username, age, todos[0..2], profile{city}}"
iex> Xitdb.Pull.compile!([:*, friends: {0..5, [:username, profile: [:city]]}])
"{*, friends[0..5]{username, profile{city}}}"
Summary
Functions
Compiles a structural Pull pattern list or validates a Pull pattern binary.
Same as compile/1, but raises ArgumentError on invalid patterns.
Types
@type pattern() :: String.t() | [pattern_entry()]
@type pattern_entry() :: atom() | String.t() | {atom() | String.t(), Range.t()} | {atom() | String.t(), {:slice, non_neg_integer(), non_neg_integer()}} | {atom() | String.t(), [pattern_entry()]} | {atom() | String.t(), {Range.t(), [pattern_entry()]}} | {atom() | String.t(), {{:slice, non_neg_integer(), non_neg_integer()}, [pattern_entry()]}}
Functions
@spec compile(pattern()) :: {:ok, String.t()} | {:error, Xitdb.Error.t()}
Compiles a structural Pull pattern list or validates a Pull pattern binary.
Same as compile/1, but raises ArgumentError on invalid patterns.