com.softinio.duck4s.effect
Members list
Type members
Classlikes
A Throwable wrapper for com.softinio.duck4s.algebra.DuckDBError, enabling error values to be raised into cats-effect IO.
A Throwable wrapper for com.softinio.duck4s.algebra.DuckDBError, enabling error values to be raised into cats-effect IO.
Value parameters
- cause
-
Optional underlying throwable that caused this error
- error
-
The underlying DuckDBError
- message
-
Human-readable error message
Attributes
- Companion
- object
- Supertypes
-
class RuntimeExceptionclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
Factory methods for creating DuckDBException from com.softinio.duck4s.algebra.DuckDBError values.
Factory methods for creating DuckDBException from com.softinio.duck4s.algebra.DuckDBError values.
Attributes
- Companion
- class
- Supertypes
- Self type
-
DuckDBException.type
Cats-effect integration for duck4s, providing cats.effect.Resource-based connection management and fs2.Stream-based result set streaming.
Cats-effect integration for duck4s, providing cats.effect.Resource-based connection management and fs2.Stream-based result set streaming.
All JDBC calls are wrapped in cats.effect.IO.blocking to avoid blocking the cats-effect thread pool. Errors are raised as DuckDBException rather than returned as Either values.
Attributes
- Note
-
DuckDB connections are NOT thread-safe. Do not share a single connection across fibers. Use
duplicate()or open separate connections per fiber. - Example
-
import com.softinio.duck4s.effect.* val program: IO[Unit] = DuckDBIO.connect().use { conn => for _ <- conn.executeUpdateIO("CREATE TABLE t (id INTEGER)") _ <- conn.executeUpdateIO("INSERT INTO t VALUES (1)") rows <- DuckDBIO.stream(conn, "SELECT id FROM t")(_.getInt("id")).compile.toList _ <- IO(println(rows)) yield () } - Supertypes
- Self type
-
DuckDBIO.type
Extensions
Extensions
Executes a SQL SELECT query and returns the result set wrapped in IO.
Executes a SQL SELECT query and returns the result set wrapped in IO.
Value parameters
- sql
-
The SQL SELECT statement to execute.
Attributes
- Returns
-
An
IO[DuckDBResultSet]. The caller is responsible for closing the result set.
Executes a SQL update statement (INSERT, UPDATE, DELETE, DDL) and returns the affected row count wrapped in IO.
Executes a SQL update statement (INSERT, UPDATE, DELETE, DDL) and returns the affected row count wrapped in IO.
Value parameters
- sql
-
The SQL statement to execute.
Attributes
- Returns
-
An
IO[Int]with the number of affected rows.
Creates a batch wrapped in IO.
Creates a batch wrapped in IO.
Value parameters
- sql
-
The SQL statement to prepare for batch execution.
Attributes
- Returns
-
An
IO[DuckDBBatch]. The caller is responsible for closing the batch.
Creates a prepared statement wrapped in IO.
Creates a prepared statement wrapped in IO.
Value parameters
- sql
-
The SQL statement to prepare.
Attributes
- Returns
-
An
IO[DuckDBPreparedStatement]. The caller is responsible for closing the statement.
Executes a block with a batch that is automatically closed.
Executes a block with a batch that is automatically closed.
Type parameters
- T
-
The result type.
Value parameters
- block
-
A function receiving the batch and returning an
IO[T]. - sql
-
The SQL statement to prepare for batch execution.
Attributes
- Returns
-
An
IO[T]with the result of the block.
Executes a block with a prepared statement that is automatically closed.
Executes a block with a prepared statement that is automatically closed.
Type parameters
- T
-
The result type.
Value parameters
- block
-
A function receiving the prepared statement and returning an
IO[T]. - sql
-
The SQL statement to prepare.
Attributes
- Returns
-
An
IO[T]with the result of the block.
Executes a block within a database transaction.
Executes a block within a database transaction.
Disables auto-commit before running the block. On success, commits the transaction. On failure (any raised error), rolls back the transaction. Auto-commit is restored to true in a guarantee finalizer regardless of outcome.
Type parameters
- T
-
The result type.
Value parameters
- block
-
A function receiving this connection and returning an
IO[T].
Attributes
- Returns
-
An
IO[T]that commits on success or rolls back on error.