SqlQuery

zio.blocks.sql.query.SqlQuery
See theSqlQuery companion object
final case class SqlQuery[A]

Immutable query IR starting from a source table.

This is the SELECT builder: joins are validated through typed Rels, rendering is performed by QueryRenderer through Frag.++ composition only, every identifier is validated and double-quoted, and values always bind as ? params.

Alias allocation is deterministic: t0 = source, t1..tN in join order (self-join safe — same Table joined twice gets distinct aliases). Rendering is performed by QueryRenderer and produces a Frag via Frag.++ composition only, using quoted identifiers and dialect placeholders.

Attributes

Companion
object
Source
SqlQuery.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def explain(dialect: SqlDialect): String

Single-line SQL with numbered ?N placeholders plus a -- params: ... footer for logging.

Single-line SQL with numbered ?N placeholders plus a -- params: ... footer for logging.

Renders via QueryRenderer and renumbers the ? placeholders as ?1, ?2, ... in bind order; the footer lists each position with its DbValue type label ((none) when the query binds no params). Values never appear in the output — only their positions and types.

Attributes

Source
SqlQuery.scala
def filter(frag: Frag): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def groupBy(cols: String*): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def having(frag: Frag): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def innerJoin[From, To](rel: Rel[From, To]): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def join[From, To](rel: Rel[From, To], kind: JoinKind): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def join[From, To](rel: Rel[From, To]): SqlQuery[A]

Alias for innerJoin — satisfies the SqlQuery.join(rel) contract.

Alias for innerJoin — satisfies the SqlQuery.join(rel) contract.

Attributes

Source
SqlQuery.scala
def joinLeft[From, To](rel: Rel[From, To]): SqlQuery[A]

Alias for leftJoin — satisfies the SqlQuery.joinLeft(rel) contract.

Alias for leftJoin — satisfies the SqlQuery.joinLeft(rel) contract.

Attributes

Source
SqlQuery.scala
def leftJoin[From, To](rel: Rel[From, To]): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def limit(n: Int): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def offset(n: Int): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def orderBy(col: String, dir: SortOrder = ...): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def orderByMany(cols: OrderBy*): SqlQuery[A]

Attributes

Source
SqlQuery.scala
def sql(dialect: SqlDialect): String

Attributes

Source
SqlQuery.scala
def toFrag(dialect: SqlDialect): Frag

Attributes

Source
SqlQuery.scala
def where(frag: Frag): SqlQuery[A]

Attributes

Source
SqlQuery.scala

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala