Supabase.PostgREST.Parser (supabase_postgrest v1.2.2)

View Source

simple parser for create statements on postgresql

Summary

Types

ast()

@type ast() :: [table() | rls_policy()]

column()

@type column() :: {name :: String.t(), attrs :: [column_def()]}

column_def()

@type column_def() ::
  {:type, String.t()}
  | {:primary, boolean()}
  | {:null, boolean()}
  | {:references, table_name()}
  | {:default, String.t()}

rls_option()

@type rls_option() ::
  {:type, :permissive | :restricted}
  | {:on, table_name()}
  | {:for, :all | :insert | :update | :delete | :select}
  | {:role, String.t()}
  | {:using, String.t()}
  | {:with_check, String.t()}

rls_policy()

@type rls_policy() :: {name :: String.t(), rls_config :: [rls_option()]}

table()

@type table() :: {table_name(), columns :: [column()]}

table_name()

@type table_name() :: {schema :: String.t(), name :: String.t()} | String.t()

Functions

run(input)

@spec run(input :: binary()) :: {:ok, ast()} | {:error, atom()}

split_input(input)