From ed132ad27636aa806a0117f5eda9d2a55b913a08 Mon Sep 17 00:00:00 2001 From: Andrew Golovashevich Date: Fri, 3 Jan 2025 16:44:08 +0300 Subject: [PATCH] Naming of DML interfaces --- .../api/v0/ddl/module/CreateModuleScope.kt | 40 +++---- ...teCreator.kt => CreateDeleteQueryScope.kt} | 4 +- ...rtCreator.kt => CreateInsertQueryScope.kt} | 16 +-- ...ctCreator.kt => CreateSelectQueryScope.kt} | 2 +- ...teCreator.kt => CreateUpdateQueryScope.kt} | 4 +- .../serdha/api/v0/dml/Delete.kt | 5 - .../serdha/api/v0/dml/DeleteQuery.kt | 5 + .../api/v0/dml/{Insert.kt => InsertQuery.kt} | 6 +- .../api/v0/dml/{Select.kt => SelectQuery.kt} | 2 +- .../serdha/api/v0/dml/Update.kt | 5 - .../serdha/api/v0/dml/UpdateQuery.kt | 5 + ...yMethods.kt => _CommonCreateQueryScope.kt} | 20 ++-- .../api/v0/runtime/SynchronizedDatabase.kt | 20 ++-- .../serdha/api/v0/runtime/Transaction.kt | 20 ++-- .../api/v0/runtime/transaction_methods.kt | 106 +++++++++--------- 15 files changed, 130 insertions(+), 130 deletions(-) rename src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/{DeleteCreator.kt => CreateDeleteQueryScope.kt} (60%) rename src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/{InsertCreator.kt => CreateInsertQueryScope.kt} (73%) rename src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/{SelectCreator.kt => CreateSelectQueryScope.kt} (67%) rename src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/{UpdateCreator.kt => CreateUpdateQueryScope.kt} (79%) delete mode 100644 src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Delete.kt create mode 100644 src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/DeleteQuery.kt rename src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/{Insert.kt => InsertQuery.kt} (66%) rename src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/{Select.kt => SelectQuery.kt} (53%) delete mode 100644 src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Update.kt create mode 100644 src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/UpdateQuery.kt rename src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/{_CommonQueryMethods.kt => _CommonCreateQueryScope.kt} (76%) diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/ddl/module/CreateModuleScope.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/ddl/module/CreateModuleScope.kt index f1fa1ca..1fff14f 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/ddl/module/CreateModuleScope.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/ddl/module/CreateModuleScope.kt @@ -1,11 +1,11 @@ package ru.landgrafhomyak.serdha.api.v0.ddl.module import ru.landgrafhomyak.serdha.api.v0.ddl.table.Table -import ru.landgrafhomyak.serdha.api.v0.dml.Delete -import ru.landgrafhomyak.serdha.api.v0.dml.Insert -import ru.landgrafhomyak.serdha.api.v0.dml.InsertCreator -import ru.landgrafhomyak.serdha.api.v0.dml.Select -import ru.landgrafhomyak.serdha.api.v0.dml.Update +import ru.landgrafhomyak.serdha.api.v0.dml.DeleteQuery +import ru.landgrafhomyak.serdha.api.v0.dml.InsertQuery +import ru.landgrafhomyak.serdha.api.v0.dml.CreateInsertQueryScope +import ru.landgrafhomyak.serdha.api.v0.dml.SelectQuery +import ru.landgrafhomyak.serdha.api.v0.dml.UpdateQuery import ru.landgrafhomyak.serdha.api.v0.runtime.SynchronizedDatabase import ru.landgrafhomyak.serdha.api.v0.runtime.Transaction @@ -101,7 +101,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createSelectQuery */ - public fun createSelect(creator: ru.landgrafhomyak.serdha.api.v0.dml.SelectCreator): QueryUserWrapper + public fun createSelect(creator: ru.landgrafhomyak.serdha.api.v0.dml.CreateSelectQueryScope): QueryUserWrapper } /** @@ -115,7 +115,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createTemporarySelectQuery */ - public fun createSelectQuery(initializer: SelectQueryCreator): Select + public fun createSelectQuery(initializer: SelectQueryCreator): SelectQuery /** * Creates 'SELECT' query accessible only while the module is [creating][ModuleTemplate.ModuleCreator] or [updating][ModuleTemplate.ModuleUpgrade]. @@ -129,7 +129,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createSelectQuery */ - public fun createTemporarySelectQuery(initializer: SelectQueryCreator): Select + public fun createTemporarySelectQuery(initializer: SelectQueryCreator): SelectQuery /** * Functional interface for creating 'INSERT ... VALUES' query. @@ -151,7 +151,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createInsertParamsQuery */ - public fun createInsert(table: Table, creator: InsertCreator.InsertParams): QueryUserWrapper + public fun createInsert(table: Table, creator: CreateInsertQueryScope.InsertParams): QueryUserWrapper } /** @@ -166,7 +166,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createTemporaryInsertParamsQuery */ - public fun createInsertParamsQuery(table: Table, initializer: InsertParamsQueryCreator): Insert.InsertParams + public fun createInsertParamsQuery(table: Table, initializer: InsertParamsQueryCreator): InsertQuery.InsertParams /** * Creates 'INSERT ... VALUES' query accessible only while the module is [creating][ModuleTemplate.ModuleCreator] or [updating][ModuleTemplate.ModuleUpgrade]. @@ -181,7 +181,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createInsertParamsQuery */ - public fun createTemporaryInsertParamsQuery(table: Table, initializer: InsertParamsQueryCreator): Insert.InsertParams + public fun createTemporaryInsertParamsQuery(table: Table, initializer: InsertParamsQueryCreator): InsertQuery.InsertParams /** * Functional interface for creating 'INSERT ... FROM' query. @@ -203,7 +203,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createInsertFromQueryQuery */ - public fun createInsert(table: Table, creator: InsertCreator.InsertFromQuery): QueryUserWrapper + public fun createInsert(table: Table, creator: CreateInsertQueryScope.InsertFromQuery): QueryUserWrapper } /** @@ -217,7 +217,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createTemporaryInsertFromQueryQuery */ - public fun createInsertFromQueryQuery(table: Table, initializer: InsertFromQueryQueryCreator): Insert.InsertFromQuery + public fun createInsertFromQueryQuery(table: Table, initializer: InsertFromQueryQueryCreator): InsertQuery.InsertFromQuery /** * Creates 'INSERT ... FROM' query accessible only while the module is [creating][ModuleTemplate.ModuleCreator] or [updating][ModuleTemplate.ModuleUpgrade]. @@ -231,7 +231,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createInsertFromQueryQuery */ - public fun createTemporaryInsertFromQueryQuery(table: Table, initializer: InsertFromQueryQueryCreator): Insert.InsertFromQuery + public fun createTemporaryInsertFromQueryQuery(table: Table, initializer: InsertFromQueryQueryCreator): InsertQuery.InsertFromQuery /** * Functional interface for creating 'UPDATE' query. @@ -253,7 +253,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createUpdateQuery */ - public fun createUpdate(table: Table, creator: ru.landgrafhomyak.serdha.api.v0.dml.UpdateCreator): QueryUserWrapper + public fun createUpdate(table: Table, creator: ru.landgrafhomyak.serdha.api.v0.dml.CreateUpdateQueryScope): QueryUserWrapper } /** @@ -267,7 +267,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createTemporaryUpdateQuery */ - public fun createUpdateQuery(table: Table, initializer: UpdateQueryCreator): Update + public fun createUpdateQuery(table: Table, initializer: UpdateQueryCreator): UpdateQuery /** * Creates 'UPDATE' query accessible only while the module is [creating][ModuleTemplate.ModuleCreator] or [updating][ModuleTemplate.ModuleUpgrade]. @@ -281,7 +281,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createUpdateQuery */ - public fun createTemporaryUpdateQuery(table: Table, initializer: UpdateQueryCreator): Update + public fun createTemporaryUpdateQuery(table: Table, initializer: UpdateQueryCreator): UpdateQuery /** * Functional interface for creating 'DELETE' query. @@ -303,7 +303,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createDeleteQuery */ - public fun createDelete(table: Table, creator: ru.landgrafhomyak.serdha.api.v0.dml.DeleteCreator): QueryUserWrapper + public fun createDelete(table: Table, creator: ru.landgrafhomyak.serdha.api.v0.dml.CreateDeleteQueryScope): QueryUserWrapper } /** @@ -317,7 +317,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createTemporaryDeleteQuery */ - public fun createDeleteQuery(table: Table, initializer: DeleteQueryCreator): Delete + public fun createDeleteQuery(table: Table, initializer: DeleteQueryCreator): DeleteQuery /** * Creates 'DELETE' query accessible only while the module is [creating][ModuleTemplate.ModuleCreator] or [updating][ModuleTemplate.ModuleUpgrade]. @@ -331,7 +331,7 @@ public interface CreateModuleScope { * * @see CreateModuleScope.createDeleteQuery */ - public fun createTemporaryDeleteQuery(table: Table, initializer: DeleteQueryCreator): Delete + public fun createTemporaryDeleteQuery(table: Table, initializer: DeleteQueryCreator): DeleteQuery /** * Replaces [specified namespace][rootNs] with schema provided by [template]. diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/DeleteCreator.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateDeleteQueryScope.kt similarity index 60% rename from src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/DeleteCreator.kt rename to src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateDeleteQueryScope.kt index 0e404d2..21845a7 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/DeleteCreator.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateDeleteQueryScope.kt @@ -3,12 +3,12 @@ package ru.landgrafhomyak.serdha.api.v0.dml import ru.landgrafhomyak.serdha.api.v0.Expression import ru.landgrafhomyak.serdha.api.v0.ddl.types.ColumnType -public interface DeleteCreator : _CommonQueryMethods { +public interface CreateDeleteQueryScope : _CommonCreateQueryScope { public val targetTable: SelectedTable public fun where(expression: Expression) public fun limit(size: UInt) - public val returning: _CommonQueryMethods._Returning + public val returning: _CommonCreateQueryScope._ReturningClauseScope } \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/InsertCreator.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateInsertQueryScope.kt similarity index 73% rename from src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/InsertCreator.kt rename to src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateInsertQueryScope.kt index 0bd5dbf..179b19c 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/InsertCreator.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateInsertQueryScope.kt @@ -5,32 +5,32 @@ import ru.landgrafhomyak.serdha.api.v0.ddl.table.Column import ru.landgrafhomyak.serdha.api.v0.ddl.types.ColumnType import ru.landgrafhomyak.serdha.api.v0.ddl.table.UniqueIndex -public interface InsertCreator : _CommonQueryMethods { +public interface CreateInsertQueryScope : _CommonCreateQueryScope { public val insertedValues: SelectedTable @Suppress("ClassName") - public interface _UpsertCreator { + public interface _UpsertClauseScope { public fun > oldColumnValue(c: Column): Expression public fun > updateColumn(c: Column, e: Expression) } - public fun onConflictUpdate(u: UniqueIndex, c: (_UpsertCreator) -> Unit) + public fun onConflictUpdate(u: UniqueIndex, c: (_UpsertClauseScope) -> Unit) public fun onConflictThrow(u: UniqueIndex) public fun onConflictIgnore(u: UniqueIndex) - public val returningInserted: _CommonQueryMethods._Returning + public val returningInserted: _CommonCreateQueryScope._ReturningClauseScope @Suppress("ClassName") - public interface _ReturningUpdated : _CommonQueryMethods._Returning { + public interface _ReturningUpdatedClauseScope : _CommonCreateQueryScope._ReturningClauseScope { public fun > oldColumnValue(c: Column): Expression } - public val returningUpdated: _ReturningUpdated + public val returningUpdated: _ReturningUpdatedClauseScope - public interface InsertParams : InsertCreator { + public interface InsertParams : CreateInsertQueryScope { public class DataParam<@Suppress("unused") QueryUserExtension : Any> private constructor() public val dataExpressionBuilder: Expression.Builder> @@ -45,7 +45,7 @@ public interface InsertCreator> insert(column: Column, expression: Expression>) } - public interface InsertFromQuery : InsertCreator { + public interface InsertFromQuery : CreateInsertQueryScope { public fun > insert(column: Column, expression: Expression) } } diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/SelectCreator.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateSelectQueryScope.kt similarity index 67% rename from src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/SelectCreator.kt rename to src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateSelectQueryScope.kt index 77f2f9b..f01e510 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/SelectCreator.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateSelectQueryScope.kt @@ -3,7 +3,7 @@ package ru.landgrafhomyak.serdha.api.v0.dml import ru.landgrafhomyak.serdha.api.v0.Expression import ru.landgrafhomyak.serdha.api.v0.ddl.types.ColumnType -public interface SelectCreator : _CommonQueryMethods, _CommonQueryMethods._Returning{ +public interface CreateSelectQueryScope : _CommonCreateQueryScope, _CommonCreateQueryScope._ReturningClauseScope{ public fun where(expression: Expression) public fun limit(size: UInt) diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/UpdateCreator.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateUpdateQueryScope.kt similarity index 79% rename from src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/UpdateCreator.kt rename to src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateUpdateQueryScope.kt index 8b9b1f8..494a955 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/UpdateCreator.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/CreateUpdateQueryScope.kt @@ -4,7 +4,7 @@ import ru.landgrafhomyak.serdha.api.v0.Expression import ru.landgrafhomyak.serdha.api.v0.ddl.table.Column import ru.landgrafhomyak.serdha.api.v0.ddl.types.ColumnType -public interface UpdateCreator : _CommonQueryMethods { +public interface CreateUpdateQueryScope : _CommonCreateQueryScope { public val targetTable: SelectedTable public fun > selectOldColumnValue(c: Column): Expression @@ -18,5 +18,5 @@ public interface UpdateCreator + public val returning: _CommonCreateQueryScope._ReturningClauseScope } \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Delete.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Delete.kt deleted file mode 100644 index d3da32c..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Delete.kt +++ /dev/null @@ -1,5 +0,0 @@ -package ru.landgrafhomyak.serdha.api.v0.dml - -public interface Delete : _CommonQueryMethods.CanBeSubquery { - public val userExtension: QueryUserExtension -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/DeleteQuery.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/DeleteQuery.kt new file mode 100644 index 0000000..983c0e0 --- /dev/null +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/DeleteQuery.kt @@ -0,0 +1,5 @@ +package ru.landgrafhomyak.serdha.api.v0.dml + +public interface DeleteQuery : _CommonCreateQueryScope.CanBeSubquery { + public val userExtension: QueryUserExtension +} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Insert.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/InsertQuery.kt similarity index 66% rename from src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Insert.kt rename to src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/InsertQuery.kt index 36a0cc2..961169e 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Insert.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/InsertQuery.kt @@ -1,9 +1,9 @@ package ru.landgrafhomyak.serdha.api.v0.dml -public interface Insert { +public interface InsertQuery { public val userExtension: QueryUserExtension - public interface InsertParams : Insert + public interface InsertParams : InsertQuery - public interface InsertFromQuery : Insert + public interface InsertFromQuery : InsertQuery } \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Select.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/SelectQuery.kt similarity index 53% rename from src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Select.kt rename to src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/SelectQuery.kt index 854fade..e23072f 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Select.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/SelectQuery.kt @@ -1,6 +1,6 @@ package ru.landgrafhomyak.serdha.api.v0.dml -public interface Select: _CommonQueryMethods.CanBeSubquery { +public interface SelectQuery: _CommonCreateQueryScope.CanBeSubquery { public val userExtension: QueryUserExtension public enum class Order { diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Update.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Update.kt deleted file mode 100644 index 05d308b..0000000 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/Update.kt +++ /dev/null @@ -1,5 +0,0 @@ -package ru.landgrafhomyak.serdha.api.v0.dml - -public interface Update : _CommonQueryMethods.CanBeSubquery { - public val userExtension: QueryUserExtension -} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/UpdateQuery.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/UpdateQuery.kt new file mode 100644 index 0000000..f8c9b49 --- /dev/null +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/UpdateQuery.kt @@ -0,0 +1,5 @@ +package ru.landgrafhomyak.serdha.api.v0.dml + +public interface UpdateQuery : _CommonCreateQueryScope.CanBeSubquery { + public val userExtension: QueryUserExtension +} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/_CommonQueryMethods.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/_CommonCreateQueryScope.kt similarity index 76% rename from src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/_CommonQueryMethods.kt rename to src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/_CommonCreateQueryScope.kt index 7fb845e..b51d7a6 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/_CommonQueryMethods.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/dml/_CommonCreateQueryScope.kt @@ -9,7 +9,7 @@ import ru.landgrafhomyak.serdha.api.v0.runtime.ParametersSetter import ru.landgrafhomyak.serdha.api.v0.runtime._ParametersSetter @Suppress("ClassName") -public interface _CommonQueryMethods { +public interface _CommonCreateQueryScope { public val types: ColumnType.Builder public fun selectTable(t: Table): SelectedTable @@ -27,30 +27,30 @@ public interface _CommonQueryMethods { public val updated: SelectedTable ) - public fun selectInsert(q: Insert.InsertParams, p: (SubqueryParametersSetter) -> Unit): SelectedInsert + public fun selectInsert(q: InsertQuery.InsertParams, p: (SubqueryParametersSetter) -> Unit): SelectedInsert @Suppress("FunctionName") @LowLevelApi public fun _selectInsert( - q: Insert.InsertFromQuery, + q: InsertQuery.InsertFromQuery, p: (SubqueryParametersSetter) -> Unit, - r: (_ParametersSetter._Multi, Nothing>) -> Unit + r: (_ParametersSetter._Multi, Nothing>) -> Unit ): SelectedInsert @OptIn(LowLevelApi::class) public fun selectInsertOne( - q: Insert.InsertFromQuery, + q: InsertQuery.InsertFromQuery, p: (SubqueryParametersSetter) -> Unit, - r: (ParametersSetter>) -> Unit + r: (ParametersSetter>) -> Unit ): SelectedInsert = this._selectInsert(q, p, r) @OptIn(LowLevelApi::class) public fun selectInsertMulti( - q: Insert.InsertFromQuery, + q: InsertQuery.InsertFromQuery, p: (SubqueryParametersSetter) -> Unit, data: Iterable, - r: (T, ParametersSetter>) -> Unit + r: (T, ParametersSetter>) -> Unit ): SelectedInsert = this._selectInsert(q, p) { rr -> for (e in data) r(e, rr) } @@ -58,12 +58,12 @@ public interface _CommonQueryMethods { public val expressionBuilder: Expression.Builder - public interface _Returning { + public interface _ReturningClauseScope { public fun > returnExpression(expression: Expression): Column public val isDistinct: Boolean - public fun orderBy(order: Select.Order, vararg columns: Expression<*, *, QueryUserExtension>) + public fun orderBy(order: SelectQuery.Order, vararg columns: Expression<*, *, QueryUserExtension>) public fun groupBy(vararg columns: Expression<*, *, QueryUserExtension>) } diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/SynchronizedDatabase.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/SynchronizedDatabase.kt index 97ba347..a66d823 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/SynchronizedDatabase.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/SynchronizedDatabase.kt @@ -4,11 +4,11 @@ import ru.landgrafhomyak.serdha.api.v0.LowLevelApi import ru.landgrafhomyak.serdha.api.v0.ddl.module.Module import ru.landgrafhomyak.serdha.api.v0.ddl.types.RowId import ru.landgrafhomyak.serdha.api.v0.ddl.table.Table -import ru.landgrafhomyak.serdha.api.v0.dml.Delete -import ru.landgrafhomyak.serdha.api.v0.dml.Insert -import ru.landgrafhomyak.serdha.api.v0.dml.InsertCreator -import ru.landgrafhomyak.serdha.api.v0.dml.Select -import ru.landgrafhomyak.serdha.api.v0.dml.Update +import ru.landgrafhomyak.serdha.api.v0.dml.DeleteQuery +import ru.landgrafhomyak.serdha.api.v0.dml.InsertQuery +import ru.landgrafhomyak.serdha.api.v0.dml.CreateInsertQueryScope +import ru.landgrafhomyak.serdha.api.v0.dml.SelectQuery +import ru.landgrafhomyak.serdha.api.v0.dml.UpdateQuery public interface SynchronizedDatabase : Module { @Suppress("FunctionName") @@ -17,23 +17,23 @@ public interface SynchronizedDatabase : Module _autoTransactedSelect(query: Select): _ParametersSetter> + public suspend fun _autoTransactedSelect(query: SelectQuery): _ParametersSetter> @Suppress("FunctionName") @LowLevelApi - public suspend fun _autoTransactedInsertParams(query: Insert.InsertParams): _ParametersSetter, _ResultSet>?>> + public suspend fun _autoTransactedInsertParams(query: InsertQuery.InsertParams): _ParametersSetter, _ResultSet>?>> @Suppress("FunctionName") @LowLevelApi - public suspend fun _autoTransactedInsertFromQuery(query: Insert.InsertFromQuery): _ParametersSetter>?> + public suspend fun _autoTransactedInsertFromQuery(query: InsertQuery.InsertFromQuery): _ParametersSetter>?> @Suppress("FunctionName") @LowLevelApi - public suspend fun _autoTransactedUpdate(query: Update): _ParametersSetter?> + public suspend fun _autoTransactedUpdate(query: UpdateQuery): _ParametersSetter?> @Suppress("FunctionName") @LowLevelApi - public suspend fun _autoTransactedDelete(query: Delete): _ParametersSetter?> + public suspend fun _autoTransactedDelete(query: DeleteQuery): _ParametersSetter?> public interface AtomicScript { public suspend fun executeTransaction(transaction: Transaction, context: C, args: A): R diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/Transaction.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/Transaction.kt index ae77750..4b7a613 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/Transaction.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/Transaction.kt @@ -1,32 +1,32 @@ package ru.landgrafhomyak.serdha.api.v0.runtime import ru.landgrafhomyak.serdha.api.v0.LowLevelApi -import ru.landgrafhomyak.serdha.api.v0.dml.Delete -import ru.landgrafhomyak.serdha.api.v0.dml.Insert -import ru.landgrafhomyak.serdha.api.v0.dml.InsertCreator -import ru.landgrafhomyak.serdha.api.v0.dml.Select -import ru.landgrafhomyak.serdha.api.v0.dml.Update +import ru.landgrafhomyak.serdha.api.v0.dml.DeleteQuery +import ru.landgrafhomyak.serdha.api.v0.dml.InsertQuery +import ru.landgrafhomyak.serdha.api.v0.dml.CreateInsertQueryScope +import ru.landgrafhomyak.serdha.api.v0.dml.SelectQuery +import ru.landgrafhomyak.serdha.api.v0.dml.UpdateQuery public interface Transaction { @Suppress("FunctionName") @LowLevelApi - public fun _select(compiledQuery: Select): _ParametersSetter> + public fun _select(compiledQuery: SelectQuery): _ParametersSetter> @Suppress("FunctionName") @LowLevelApi - public fun _insertParams(compiledQuery: Insert.InsertParams): _ParametersSetter, _ResultSet>?>> + public fun _insertParams(compiledQuery: InsertQuery.InsertParams): _ParametersSetter, _ResultSet>?>> @Suppress("FunctionName") @LowLevelApi - public fun _insertFromQuery(compiledQuery: Insert.InsertFromQuery): _ParametersSetter>?> + public fun _insertFromQuery(compiledQuery: InsertQuery.InsertFromQuery): _ParametersSetter>?> @Suppress("FunctionName") @LowLevelApi - public fun _update(compiledQuery: Update): _ParametersSetter?> + public fun _update(compiledQuery: UpdateQuery): _ParametersSetter?> @Suppress("FunctionName") @LowLevelApi - public fun _delete(compiledQuery: Delete): _ParametersSetter?> + public fun _delete(compiledQuery: DeleteQuery): _ParametersSetter?> public suspend fun rollback() diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/transaction_methods.kt b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/transaction_methods.kt index 639063e..a88f8f5 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/transaction_methods.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/serdha/api/v0/runtime/transaction_methods.kt @@ -6,11 +6,11 @@ import kotlin.contracts.InvocationKind import kotlin.contracts.contract import kotlin.jvm.JvmName import ru.landgrafhomyak.serdha.api.v0.LowLevelApi -import ru.landgrafhomyak.serdha.api.v0.dml.Delete -import ru.landgrafhomyak.serdha.api.v0.dml.Insert -import ru.landgrafhomyak.serdha.api.v0.dml.InsertCreator -import ru.landgrafhomyak.serdha.api.v0.dml.Select -import ru.landgrafhomyak.serdha.api.v0.dml.Update +import ru.landgrafhomyak.serdha.api.v0.dml.DeleteQuery +import ru.landgrafhomyak.serdha.api.v0.dml.InsertQuery +import ru.landgrafhomyak.serdha.api.v0.dml.CreateInsertQueryScope +import ru.landgrafhomyak.serdha.api.v0.dml.SelectQuery +import ru.landgrafhomyak.serdha.api.v0.dml.UpdateQuery @Suppress("FunctionName") @@ -170,7 +170,7 @@ internal suspend inline fun _wrapWithLambdasMap( @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedSelectSingleOrNull( - compiledQuery: Select, + compiledQuery: SelectQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): R? { @@ -190,7 +190,7 @@ public suspend inline fun SynchronizedDatabase<*>.au @OptIn(LowLevelApi::class) public suspend inline fun Transaction.selectSingleOrNull( - compiledQuery: Select, + compiledQuery: SelectQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): R? { @@ -211,7 +211,7 @@ public suspend inline fun Transaction.selectSingleOr @OptIn(LowLevelApi::class) public suspend inline fun Transaction.selectThenIterate( - compiledQuery: Select, + compiledQuery: SelectQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> Unit ) { @@ -231,7 +231,7 @@ public suspend inline fun Transaction.selectThenIterate @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedSelectThenIterate( - compiledQuery: Select, + compiledQuery: SelectQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> Unit ) { @@ -251,7 +251,7 @@ public suspend inline fun SynchronizedDatabase<*>.autoT @OptIn(LowLevelApi::class) public suspend inline fun Transaction.selectThenMap( - compiledQuery: Select, + compiledQuery: SelectQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): List { @@ -272,7 +272,7 @@ public suspend inline fun Transaction.selectThenMap( @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedSelectThenMap( - compiledQuery: Select, + compiledQuery: SelectQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): List { @@ -294,11 +294,11 @@ public suspend inline fun SynchronizedDatabase<*>.au @PublishedApi @OptIn(LowLevelApi::class) internal suspend inline fun _wrapInsertParamsWithLambdas( - compiledQuery: Insert.InsertParams, - queryGetter: () -> _ParametersSetter, _ResultSet>?>>, + compiledQuery: InsertQuery.InsertParams, + queryGetter: () -> _ParametersSetter, _ResultSet>?>>, parameters: (ParametersSetter) -> Unit, data: Iterable, - rowFormatter: (T, ParametersSetter>) -> Unit, + rowFormatter: (T, ParametersSetter>) -> Unit, hasReturning: Boolean, returningInserted: (_ResultSet) -> Unit, returningUpdated: (_ResultSet) -> Unit, @@ -343,10 +343,10 @@ internal suspend inline fun _wrapInsertParamsWithLambdas( @OptIn(LowLevelApi::class) public suspend inline fun Transaction.insertParams( - compiledQuery: Insert.InsertParams, + compiledQuery: InsertQuery.InsertParams, parameters: (ParametersSetter) -> Unit = {}, data: Iterable, - rowFormatter: (T, ParametersSetter>) -> Unit, + rowFormatter: (T, ParametersSetter>) -> Unit, ) { contract { callsInPlace(parameters, InvocationKind.EXACTLY_ONCE) @@ -367,10 +367,10 @@ public suspend inline fun Transaction.insertParams( @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedInsertParams( - compiledQuery: Insert.InsertParams, + compiledQuery: InsertQuery.InsertParams, parameters: (ParametersSetter) -> Unit = {}, data: Iterable, - rowFormatter: (T, ParametersSetter>) -> Unit, + rowFormatter: (T, ParametersSetter>) -> Unit, ) { contract { callsInPlace(parameters, InvocationKind.EXACTLY_ONCE) @@ -391,10 +391,10 @@ public suspend inline fun SynchronizedDatabase<*>.au @OptIn(LowLevelApi::class) public suspend inline fun Transaction.insertParamsReturningIterate( - compiledQuery: Insert.InsertParams, + compiledQuery: InsertQuery.InsertParams, parameters: (ParametersSetter) -> Unit = {}, data: Iterable, - rowFormatter: (T, ParametersSetter>) -> Unit, + rowFormatter: (T, ParametersSetter>) -> Unit, insertedRows: (Row) -> Unit, updatedRows: (Row) -> Unit, ) { @@ -417,10 +417,10 @@ public suspend inline fun Transaction.insertParamsRe @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedInsertParametersReturningIterate( - compiledQuery: Insert.InsertParams, + compiledQuery: InsertQuery.InsertParams, parameters: (ParametersSetter) -> Unit = {}, data: Iterable, - rowFormatter: (T, ParametersSetter>) -> Unit, + rowFormatter: (T, ParametersSetter>) -> Unit, insertedRows: (Row) -> Unit, updatedRows: (Row) -> Unit, ) { @@ -458,9 +458,9 @@ internal object SingleIterable : Iterable, Iterator { @OptIn(LowLevelApi::class) public suspend inline fun Transaction.insertSingle( - compiledQuery: Insert.InsertParams, + compiledQuery: InsertQuery.InsertParams, parameters: (ParametersSetter) -> Unit = {}, - rowData: (ParametersSetter>) -> Unit, + rowData: (ParametersSetter>) -> Unit, ) { contract { callsInPlace(parameters, InvocationKind.EXACTLY_ONCE) @@ -481,9 +481,9 @@ public suspend inline fun Transaction.insertSingle( @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedInsertSingle( - compiledQuery: Insert.InsertParams, + compiledQuery: InsertQuery.InsertParams, parameters: (ParametersSetter) -> Unit = {}, - rowData: (ParametersSetter>) -> Unit, + rowData: (ParametersSetter>) -> Unit, ) { contract { callsInPlace(parameters, InvocationKind.EXACTLY_ONCE) @@ -505,9 +505,9 @@ public suspend inline fun SynchronizedDatabase<*>.autoT @Suppress("DuplicatedCode") @OptIn(LowLevelApi::class) public suspend inline fun Transaction.insertSingleReturning( - compiledQuery: Insert.InsertParams, + compiledQuery: InsertQuery.InsertParams, parameters: (ParametersSetter) -> Unit = {}, - rowData: (ParametersSetter>) -> Unit = {}, + rowData: (ParametersSetter>) -> Unit = {}, insertedRows: (Row) -> R, updatedRows: (Row) -> R ): R { @@ -550,9 +550,9 @@ public suspend inline fun Transaction.insertSingleRe @Suppress("DuplicatedCode") @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedInsertSingleReturning( - compiledQuery: Insert.InsertParams, + compiledQuery: InsertQuery.InsertParams, parameters: (ParametersSetter) -> Unit = {}, - rowData: (ParametersSetter>) -> Unit = {}, + rowData: (ParametersSetter>) -> Unit = {}, insertedRows: (Row) -> R, updatedRows: (Row) -> R ): R { @@ -596,7 +596,7 @@ public suspend inline fun SynchronizedDatabase<*>.au @PublishedApi @OptIn(LowLevelApi::class) internal suspend inline fun _wrapInsertFromQueryWithLambdas( - compiledQuery: Insert.InsertFromQuery, + compiledQuery: InsertQuery.InsertFromQuery, queryGetter: () -> _ParametersSetter>?>, parameters: (ParametersSetter) -> Unit, hasReturning: Boolean, @@ -634,7 +634,7 @@ internal suspend inline fun _wrapInsertFromQueryWithLambdas( @OptIn(LowLevelApi::class) public suspend inline fun Transaction.insertFromQuery( - compiledQuery: Insert.InsertFromQuery, + compiledQuery: InsertQuery.InsertFromQuery, parameters: (ParametersSetter) -> Unit = {}, ) { contract { @@ -653,7 +653,7 @@ public suspend inline fun Transaction.insertFromQuery( @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedInsertFromQuery( - compiledQuery: Insert.InsertFromQuery, + compiledQuery: InsertQuery.InsertFromQuery, parameters: (ParametersSetter) -> Unit = {}, ) { contract { @@ -672,7 +672,7 @@ public suspend inline fun SynchronizedDatabase<*>.autoT @OptIn(LowLevelApi::class) public suspend inline fun Transaction.insertFromQueryReturningIterate( - compiledQuery: Insert.InsertFromQuery, + compiledQuery: InsertQuery.InsertFromQuery, parameters: (ParametersSetter) -> Unit = {}, insertedRows: (Row) -> Unit, updatedRows: (Row) -> Unit @@ -695,7 +695,7 @@ public suspend inline fun Transaction.insertFromQueryRe @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedInsertFromQueryReturningIterate( - compiledQuery: Insert.InsertFromQuery, + compiledQuery: InsertQuery.InsertFromQuery, parameters: (ParametersSetter) -> Unit = {}, insertedRows: (Row) -> Unit, updatedRows: (Row) -> Unit @@ -718,7 +718,7 @@ public suspend inline fun SynchronizedDatabase<*>.autoT @OptIn(LowLevelApi::class) public suspend inline fun Transaction.insertFromQueryReturningSingleOrNull( - compiledQuery: Insert.InsertFromQuery, + compiledQuery: InsertQuery.InsertFromQuery, parameters: (ParametersSetter) -> Unit = {}, insertedRows: (Row) -> R, updatedRows: (Row) -> R @@ -757,7 +757,7 @@ public suspend inline fun Transaction.insertFromQuer @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedInsertFromQueryReturningSingleOrNull( - compiledQuery: Insert.InsertFromQuery, + compiledQuery: InsertQuery.InsertFromQuery, parameters: (ParametersSetter) -> Unit = {}, insertedRows: (Row) -> R, updatedRows: (Row) -> R @@ -796,7 +796,7 @@ public suspend inline fun SynchronizedDatabase<*>.au @OptIn(LowLevelApi::class) public suspend inline fun Transaction.update( - compiledQuery: Update, + compiledQuery: UpdateQuery, parameters: (ParametersSetter) -> Unit = {}, ) { contract { @@ -814,7 +814,7 @@ public suspend inline fun Transaction.update( @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedUpdate( - compiledQuery: Update, + compiledQuery: UpdateQuery, parameters: (ParametersSetter) -> Unit = {}, ) { contract { @@ -832,7 +832,7 @@ public suspend inline fun SynchronizedDatabase<*>.autoT @OptIn(LowLevelApi::class) public suspend inline fun Transaction.updateReturningSingleOrNull( - compiledQuery: Update, + compiledQuery: UpdateQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): R? { @@ -853,7 +853,7 @@ public suspend inline fun Transaction.updateReturnin @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedUpdateReturningSingleOrNull( - compiledQuery: Update, + compiledQuery: UpdateQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): R? { @@ -873,7 +873,7 @@ public suspend inline fun SynchronizedDatabase<*>.au @OptIn(LowLevelApi::class) public suspend inline fun Transaction.updateReturningIterate( - compiledQuery: Update, + compiledQuery: UpdateQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> Unit ) { @@ -893,7 +893,7 @@ public suspend inline fun Transaction.updateReturningIt @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedUpdateReturningIterate( - compiledQuery: Update, + compiledQuery: UpdateQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> Unit ) { @@ -913,7 +913,7 @@ public suspend inline fun SynchronizedDatabase<*>.autoT @OptIn(LowLevelApi::class) public suspend inline fun Transaction.updateReturningMap( - compiledQuery: Update, + compiledQuery: UpdateQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): List { @@ -933,7 +933,7 @@ public suspend inline fun Transaction.updateReturnin @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedUpdateReturningMap( - compiledQuery: Update, + compiledQuery: UpdateQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): List { @@ -953,7 +953,7 @@ public suspend inline fun SynchronizedDatabase<*>.au @OptIn(LowLevelApi::class) public suspend inline fun Transaction.delete( - compiledQuery: Delete, + compiledQuery: DeleteQuery, parameters: (ParametersSetter) -> Unit = {}, ) { contract { @@ -971,7 +971,7 @@ public suspend inline fun Transaction.delete( @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedDelete( - compiledQuery: Delete, + compiledQuery: DeleteQuery, parameters: (ParametersSetter) -> Unit = {}, ) { contract { @@ -989,7 +989,7 @@ public suspend inline fun SynchronizedDatabase<*>.autoT @OptIn(LowLevelApi::class) public suspend inline fun Transaction.deleteReturningSingleOrNull( - compiledQuery: Delete, + compiledQuery: DeleteQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): R? { @@ -1010,7 +1010,7 @@ public suspend inline fun Transaction.deleteReturnin @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedDeleteReturningSingleOrNull( - compiledQuery: Delete, + compiledQuery: DeleteQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): R? { @@ -1030,7 +1030,7 @@ public suspend inline fun SynchronizedDatabase<*>.au @OptIn(LowLevelApi::class) public suspend inline fun Transaction.deleteReturningIterate( - compiledQuery: Delete, + compiledQuery: DeleteQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> Unit ) { @@ -1050,7 +1050,7 @@ public suspend inline fun Transaction.deleteReturningIt @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedDeleteReturningIterate( - compiledQuery: Delete, + compiledQuery: DeleteQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> Unit ) { @@ -1070,7 +1070,7 @@ public suspend inline fun SynchronizedDatabase<*>.autoT @OptIn(LowLevelApi::class) public suspend inline fun Transaction.deleteReturningMap( - compiledQuery: Delete, + compiledQuery: DeleteQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): List { @@ -1090,7 +1090,7 @@ public suspend inline fun Transaction.deleteReturnin @OptIn(LowLevelApi::class) public suspend inline fun SynchronizedDatabase<*>.autoTransactedDeleteReturningMap( - compiledQuery: Delete, + compiledQuery: DeleteQuery, parameters: (ParametersSetter) -> Unit = {}, rowsConsumer: (Row) -> R ): List {