PgRest.Parser.Select (PgRest v0.1.0)

Copy Markdown View Source

Parses PostgREST select parameter into an AST.

Supports field selection, embed preloading with !inner modifier, embed aliasing via alias:name(...), nested embeds, and empty embeds for anti-joins.

Examples

iex> PgRest.Parser.Select.parse("id,name,email")
{:ok, [%{type: :field, name: "id"}, %{type: :field, name: "name"}, %{type: :field, name: "email"}]}

iex> PgRest.Parser.Select.parse("id,posts(id,title)")
{:ok, [%{type: :field, name: "id"}, %{type: :embed, name: "posts", fields: ["id", "title"], inner: false}]}

Summary

Functions

Parses a select parameter string into a list of field and embed AST nodes.

Functions

parse(select_str)

@spec parse(String.t()) :: {:ok, [map()]}

Parses a select parameter string into a list of field and embed AST nodes.