RawQueryBuilder
Defines the public API for passing a complete raw SQL query.
// Call a PostgreSQL function directly
dataAccess.rawQuery("SELECT * FROM calculate_tribute(@province, @year)")
.toField<Int>("province" to "Aegyptus", "year" to 44)Functions
Converts this builder to a StepBuilderMethods for lazy execution within a TransactionPlan.
Creates and returns a deep copy of this builder. Useful for creating query variants from a shared base without modifying the original.
Switches the builder to iterative mode, optimal for large datasets.
Configures additional options for this query.
Fetches a single value from the first column of the first row. Always returns Failure if no rows are found, regardless of nullability. Nullability only controls whether a null value in the column is allowed: use toFieldStrict<Int>() to fail on null, or toFieldStrict<Int?>() to allow null values.
Maps results to a list of objects using the provided mapper. This bypasses reflection and is the most efficient way to map results to domain objects.
Maps results to a list of objects of the given type. Requires that column names/aliases in SQL (in snake_case convention) match property names in the target class (in camelCase convention) or have a @MapKey annotation with the stored column name.
Maps the result to a single object of the given type. Works on the same mapping principle as toListOf. Nullability is determined by the KType: use toSingleOf<User>() for non-null or toSingleOf<User?>() for nullable results.
Maps the result to a single object using the provided mapper. Nullability is determined by the KType: use toSingleOf<User>(mapper) for non-null or toSingleOf<User?>(mapper) for nullable results. This bypasses reflection and is the most efficient way to map results to domain objects.
Fetches a single row as Map