galchemy/sql/compiler

Types

pub type CompileError {
  MissingFrom
  EmptyInList
  EmptyInsertValues
  EmptyUpdateAssignments
  InconsistentInsertRowShape
  HavingWithoutGroupBy
  InvalidFunctionName(String)
  InvalidLimit(Int)
  InvalidOffset(Int)
}

Constructors

  • MissingFrom
  • EmptyInList
  • EmptyInsertValues
  • EmptyUpdateAssignments
  • InconsistentInsertRowShape
  • HavingWithoutGroupBy
  • InvalidFunctionName(String)
  • InvalidLimit(Int)
  • InvalidOffset(Int)
pub type CompiledQuery {
  CompiledQuery(sql: String, params: List(expression.SqlValue))
}

Constructors

pub type CompilerConfig {
  CompilerConfig(
    render_identifier: fn(String) -> String,
    validate_function_name: fn(String) -> Result(
      String,
      CompileError,
    ),
  )
}

Constructors

  • CompilerConfig(
      render_identifier: fn(String) -> String,
      validate_function_name: fn(String) -> Result(
        String,
        CompileError,
      ),
    )

Values

pub fn compile(
  q: query.Query,
) -> Result(CompiledQuery, CompileError)
pub fn compile_delete(
  q: query.DeleteQuery,
) -> Result(CompiledQuery, CompileError)
pub fn compile_delete_with(
  q: query.DeleteQuery,
  config: CompilerConfig,
) -> Result(CompiledQuery, CompileError)
pub fn compile_insert(
  q: query.InsertQuery,
) -> Result(CompiledQuery, CompileError)
pub fn compile_insert_with(
  q: query.InsertQuery,
  config: CompilerConfig,
) -> Result(CompiledQuery, CompileError)
pub fn compile_select_with(
  q: expression.SelectQuery,
  config: CompilerConfig,
) -> Result(CompiledQuery, CompileError)
pub fn compile_update(
  q: query.UpdateQuery,
) -> Result(CompiledQuery, CompileError)
pub fn compile_update_with(
  q: query.UpdateQuery,
  config: CompilerConfig,
) -> Result(CompiledQuery, CompileError)
pub fn compile_with(
  q: query.Query,
  config: CompilerConfig,
) -> Result(CompiledQuery, CompileError)
pub fn default_config() -> CompilerConfig
Search Document