Attributes
- Companion
- class
- Source
- Frag.scala
- Graph
-
- Supertypes
- Self type
-
Frag.type
Members list
Type members
Inherited and Abstract types
The names of the product elements.
The name of the type.
Value members
Concrete methods
Keyset pagination fragment for a single ordering column.
Keyset pagination fragment for a single ordering column.
Produces WHERE > ? ORDER BY ASC LIMIT n as a Frag with one bound parameter (lastValue). The ordering column is validated as a SQL identifier; when a table is supplied the column must also exist in table.columns.
Single column only — composite cursors are intentionally unsupported (v2).
Attributes
- Throws
-
IllegalArgumentException
if
orderColis not a valid identifier, not intable.columns(when a table is supplied), or iflimit <= 0 - Source
- Frag.scala
Keyset pagination fragment without a table binding.
Keyset pagination fragment without a table binding.
Validates orderCol as a SQL identifier and produces WHERE > ? ORDER BY ASC LIMIT n.
Attributes
- Throws
-
IllegalArgumentException
if
orderColis not a valid identifier orlimit <= 0 - Source
- Frag.scala
Wraps a parameter-free SQL string as a fragment.
Concatenates multiple fragments with no separator between them. Returns Frag.empty when called with no arguments.
Concatenates multiple fragments with no separator between them. Returns Frag.empty when called with no arguments.
Attributes
- Source
- Frag.scala
Builds a VALUES clause for a multi-row INSERT. Renders as: (?, ?), (?, ?), ... — one tuple per row, columns within each tuple separated by ,.
Builds a VALUES clause for a multi-row INSERT. Renders as: (?, ?), (?, ?), ... — one tuple per row, columns within each tuple separated by ,.
Attributes
- Throws
-
IllegalArgumentException
if
rowsis empty (empty VALUES is invalid SQL) - Source
- Frag.scala
Concrete fields
An empty fragment that contributes no SQL text and no parameters.
Extensions
Extensions
Executes this fragment as a SELECT and returns all decoded rows.
Executes this fragment as a SELECT and returns the decoded rows as a stream of Chunks, each holding up to chunkSize rows.
Executes this fragment as a SELECT and returns the decoded rows as a stream of Chunks, each holding up to chunkSize rows.
The statement and result set are acquired lazily on the first pull and released when the stream is closed or fully drained (via Stream.fromAcquireRelease). Rows are batched by the streams layer's Reader.readN inside Stream.chunked rather than a manual List.newBuilder loop. SQL failures surface as typed errors (Left) from terminal operations such as runCollect.
Because acquisition is lazy, the stream must be consumed within the scope that provides the DbCon: leaving Transactor.connect/transact closes the captured connection, and pulling afterwards fails.
Type parameters
- A
-
the row type, decoded through
codec's column mapping
Value parameters
- chunkSize
-
maximum number of rows per emitted
Chunk; must be>= 1 - codec
-
decoder for the expected row shape
- con
-
the connection context providing the connection, dialect, and logger
Attributes
- Returns
-
a lazy stream of decoded row chunks; terminal operations answer
Left(error)on SQL failure - Throws
-
IllegalArgumentException
if
chunkSizeis less than 1 - Example
-
Transactor.connect(transactor) { sql"SELECT id, name FROM users" .queryChunked[User](500) .runFold(0)((acc, chunk) => acc + chunk.size) } - Source
- Frag.scala
Executes this fragment as a SELECT with a row limit.
Executes this fragment as a SELECT and returns the first row, if any.
Executes this fragment as a SELECT and returns the decoded rows as a stream of Chunks, each holding up to DefaultQueryChunkSize rows.
Executes this fragment as a SELECT and returns the decoded rows as a stream of Chunks, each holding up to DefaultQueryChunkSize rows.
Equivalent to queryChunked[A](DefaultQueryChunkSize).
Type parameters
- A
-
the row type, decoded through
codec's column mapping
Value parameters
- codec
-
decoder for the expected row shape
- con
-
the connection context providing the connection, dialect, and logger
Attributes
- Returns
-
a lazy stream of decoded row chunks; see queryChunked for the acquisition lifetime and error behavior
- Example
-
val chunks: Stream[Throwable, Chunk[User]] = sql"SELECT id, name FROM users".queryStream[User] val total = chunks.runFold(0)((n, chunk) => n + chunk.size) - Source
- Frag.scala
Executes this fragment as an INSERT/UPDATE/DELETE and returns the affected row count.
Executes this fragment as an INSERT/UPDATE/DELETE and returns the affected row count.
Attributes
- Source
- Frag.scala
Executes this fragment as an INSERT and returns auto-generated keys.