AyeSQL.AST.Context (AyeSQL v1.1.4)

Copy Markdown View Source

This module defines an AST context.

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.

Types

arguments()

@type arguments() :: [term()]

Argument list.

error()

@type error() :: {AyeSQL.Core.parameter_name(), error_type()}

Error.

error_type()

@type error_type() :: :not_found

Error type.

index()

@type index() :: non_neg_integer()

Current context index.

statement()

@type statement() :: [binary()]

Accumulated statement.

t()

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

AST context.

Functions

%AyeSQL.AST.Context{}

(struct)

AST context struct.

add_index(context, value \\ 1)

@spec add_index(t(), non_neg_integer()) :: t()

Adds a value to the context index.

id(context)

@spec id(t()) :: t()

Context id function.

merge(old, new)

@spec merge(t(), t()) :: t()

Merges two contexts.

merge_error(context, error)

@spec merge_error(t(), AyeSQL.Error.t()) :: t()

Merges a context with an error

merge_query(context, query)

@spec merge_query(t(), AyeSQL.Query.t()) :: t()

Merges a context with a query.

new(options)

@spec new(keyword()) :: t() | no_return()

Creates a new context given some options.

not_found(context, key)

@spec not_found(t(), AyeSQL.Core.parameter_name()) :: t()

Updates context with the error not found for a key.

put_argument(context, value)

@spec put_argument(t(), term()) :: t()

Adds arguments in a context given a new value.

put_statement(context, value \\ nil)

@spec put_statement(t(), nil | binary()) :: t()

Adds statement in a context given a new value.

put_variable(context, value)

@spec put_variable(t(), term()) :: t()

Puts a new variable value in the context.

put_variables(context, values)

@spec put_variables(t(), [term()]) :: t()

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

to_query(context)

@spec to_query(t()) :: {:ok, AyeSQL.Query.t()} | {:error, AyeSQL.Error.t()}

Transforms a context to a query.