SqlLiteral

zio.blocks.sql.SqlLiteral
See theSqlLiteral companion object
final case class SqlLiteral(sql: String)

Escape hatch for unchecked raw SQL.

SqlLiteral holds a SQL string that is spliced verbatim into a sql"..." fragment without parameter binding or identifier checking. Use it for dialect-specific functions or dynamic SQL that the lint-grade checked sql (StringContext(...).sql(table)(...)) cannot model. Prefer the checked StringContext(...).sql(table)(...) form for all hand-written queries; reserve SqlLiteral for genuinely dynamic or dialect-specific cases.

Standalone usage (unchecked, no validation):

 val frag: Frag = SqlLiteral("SELECT * FROM legacy WHERE id = 1").toFrag

Splicing into sql interpolator as a raw fragment (not a parameter):

 sql"SELECT ${SqlLiteral("MY_FUNC(id)")} FROM users"

Attributes

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

Members list

Value members

Concrete methods

def toFrag: Frag

Wraps this raw SQL string as a Frag with no parameters.

Wraps this raw SQL string as a Frag with no parameters.

Attributes

Source
SqlLiteral.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