AyeSQL v0.5.1 AyeSQL.AST.Context View Source

This module defines an AST context.

Link to this section Summary

Types

Argument list.

Error.

Error type.

Current context index.

Accumulated statement.

t()

AST context.

Functions

AST context struct.

Adds a value to the context index.

Context id function.

Merges two contexts.

Merges a context with an error

Merges a context with a query.

Creates a new context given some options.

Updates context with the error not found for a key.

Adds arguments in a context given a new value.

Adds statement in a context given a new value.

Puts a new variable value in the context.

Puts several variable value in the context as an SQL list.

Transforms a context to a query.

Link to this section Types

Link to this type

arguments()

View Source
arguments() :: [term()]

Argument list.

Error.

Link to this type

error_type()

View Source
error_type() :: :not_found

Error type.

Current context index.

Link to this type

statement()

View Source
statement() :: [binary()]

Accumulated statement.

Link to this type

t()

View Source
t() :: %AyeSQL.AST.Context{
  arguments: arguments :: arguments(),
  errors: errors :: [error()],
  index: index :: index(),
  statement: statement :: statement()
}

AST context.

Link to this section Functions

Link to this function

%AyeSQL.AST.Context{}

View Source (struct)

AST context struct.

Link to this function

add_index(context, value \\ 1)

View Source
add_index(t(), non_neg_integer()) :: t()

Adds a value to the context index.

Context id function.

Link to this function

merge(old, new)

View Source
merge(t(), t()) :: t()

Merges two contexts.

Link to this function

merge_error(context, error)

View Source
merge_error(t(), AyeSQL.Error.t()) :: t()

Merges a context with an error

Link to this function

merge_query(context, query)

View Source
merge_query(t(), AyeSQL.Query.t()) :: t()

Merges a context with a query.

Creates a new context given some options.

Link to this function

not_found(context, key)

View Source
not_found(t(), AyeSQL.Core.parameter_name()) :: t()

Updates context with the error not found for a key.

Link to this function

put_argument(context, value)

View Source
put_argument(t(), term()) :: t()

Adds arguments in a context given a new value.

Link to this function

put_statement(context, value \\ nil)

View Source
put_statement(t(), nil | binary()) :: t()

Adds statement in a context given a new value.

Link to this function

put_variable(context, value)

View Source
put_variable(t(), term()) :: t()

Puts a new variable value in the context.

Link to this function

put_variables(context, values)

View Source
put_variables(t(), [term()]) :: t()

Puts several variable value in the context as an SQL list.

Link to this function

to_query(context)

View Source
to_query(t()) :: {:ok, AyeSQL.Query.t()} | {:error, AyeSQL.Error.t()}

Transforms a context to a query.