PgRest.Grammar.Select (PgRest v0.3.0)

Copy Markdown View Source

Parser for the PostgREST select= parameter: columns with aliases, :: casts and JSON paths, aggregates, and embedded resources (alias:rel!hint!inner(...), spreads ...rel(...), empty embeds rel()).

It is a recursive-descent walk over the binary that reuses PgRest.Grammar.Common for names and JSON paths. Whitespace is ignored around tokens but is significant inside a cast type name (timestamp with time zone). A failure carries the PostgREST-shaped position and expectation.

Differences from PostgREST

Trailing select junk is rejected with PGRST100 rather than silently ignored.

Summary

Functions

Parses a select= value into select fields, aggregates and embeds.

Types

item()

@type item() :: PgRest.AST.Embed.item()

Functions

parse(input)

@spec parse(String.t()) :: {:ok, [item()]} | {:error, PgRest.Error.t()}

Parses a select= value into select fields, aggregates and embeds.