Module sub

Source
Expand description

The SpacetimeDB SQL subscription grammar

query
    = SELECT projection FROM relation [ WHERE predicate ]
    ;

projection
    = STAR
    | ident '.' STAR
    ;

relation
    = table
    | '(' query ')'
    | relation [ [AS] ident ] { [INNER] JOIN relation [ [AS] ident ] ON predicate }
    ;

predicate
    = expr
    | predicate AND predicate
    | predicate OR  predicate
    ;

expr
    = literal
    | ident
    | field
    | expr op expr
    ;

field
    = ident '.' ident
    ;

op
    = '='
    | '<'
    | '>'
    | '<' '='
    | '>' '='
    | '!' '='
    | '<' '>'
    ;

literal
    = INTEGER
    | FLOAT
    | STRING
    | HEX
    | TRUE
    | FALSE
    ;

Functionsยง

parse_subscription
Parse a SQL string