View Source AyeSQL.AST.Context (AyeSQL v1.1.3)

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

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

Argument list.

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

Error.

@type error_type() :: :not_found

Error type.

@type index() :: non_neg_integer()

Current context index.

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

Accumulated statement.

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

AST context.

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
@spec add_index(t(), non_neg_integer()) :: t()

Adds a value to the context index.

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

Context id function.

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

Merges two contexts.

Link to this function

merge_error(context, error)

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

Merges a context with an error

Link to this function

merge_query(context, query)

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

Merges a context with a query.

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

Creates a new context given some options.

@spec 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
@spec 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
@spec 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
@spec put_variable(t(), term()) :: t()

Puts a new variable value in the context.

Link to this function

put_variables(context, values)

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

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

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

Transforms a context to a query.