struct

Interro::QueryExpression

Inherits Struct < Value < Object

Constructors

new(parts : Array(Interro::Any | String))
Source
new(*parts : Part) : self
Source
parse(fragment : String, values : Array(Any) = [] of Any) : self

Parses a raw SQL fragment, resolving each $n placeholder to the value it references: $1 is values[0], and so on. Raises ArgumentError if a placeholder references no value.

Source

Instance methods

&(other : self) : self
Source
|(other : self) : self
Source
parts

The expression is just its parts: SQL text interleaved with the values to bind. Placeholder numbers are assigned when the query is rendered in #to_sql.

Source
to_sql(io : IO, args : Array(Any)) : Nil
Source
to_sql(io : IO) : Nil

Render this expression, numbering placeholders from $1. Intended for inspecting an expression; one that is about to executed should use to_sql(io, args) so that placeholders are numbered relative to the built args array.

Source
to_sql
Source
values

The values this fragment binds, in the order to_sql renders them.

Source

Nested types