ExSQL.AST.Compound (exsql v0.1.2)

Copy Markdown

A compound SELECT: two queries joined by UNION [ALL], INTERSECT, or EXCEPT.

Compounds nest left-associatively, so a UNION b UNION c parses as (a UNION b) UNION c with left itself a Compound. The ORDER BY and LIMIT clauses apply to the whole compound — SQLite rejects them on any component but the last, and so does the parser.

Summary

Types

op()

@type op() :: :union | :union_all | :intersect | :except

t()

@type t() :: %ExSQL.AST.Compound{
  left: ExSQL.AST.Select.t() | t(),
  limit: ExSQL.AST.Select.expr() | nil,
  offset: ExSQL.AST.Select.expr() | nil,
  op: op(),
  order_by: [{ExSQL.AST.Select.expr(), :asc | :desc}],
  right: ExSQL.AST.Select.t()
}