ChDriver.Query (ch_driver v0.1.1)

Copy Markdown

A query for ChDriver.DBConnection: a raw SQL string, plus enough parsed state to bind parameters to it.

statement can use plain ? positional placeholders, or ClickHouse's own {name:Type} named placeholders written directly. Application code doesn't build this struct directly — pass a SQL string to ChDriver.query/2,3,4 and it gets wrapped for you.

Placeholder positions are lexed once (quote-aware, so a ? inside a string literal is never mistaken for a bind position) and cached across repeated executions of the same prepared query, matching the shape of Postgrex.Query.

Summary

Types

segment()

@type segment() :: binary() | :placeholder

t()

@type t() :: %ChDriver.Query{
  param_names: [binary()] | nil,
  param_types: [binary() | nil] | nil,
  query_id: binary() | nil,
  segments: [segment()] | nil,
  statement: binary()
}