zio.blocks.sql.SqlLiteral
See theSqlLiteral companion object
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
Members list
In this article