Compare commits
No commits in common. "master" and "master" have entirely different histories.
@ -18,7 +18,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
group = "ru.landgrafhomyak.db.skeleton"
|
||||
group = "ru.landgrafhomyak.db.serdha"
|
||||
version = "0.0"
|
||||
|
||||
repositories {
|
||||
@ -41,7 +41,6 @@ xomrk {
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,7 +48,7 @@ xomrk {
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
defineXomrkGiteaMavenRepo(user="DatabaseSkeleton")
|
||||
defineXomrkGiteaMavenRepo(user="SERDHA")
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +1,5 @@
|
||||
rootProject.name = "db-skeleton-1-api"
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||
}
|
||||
rootProject.name = "serdha-0-api"
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api
|
||||
|
||||
public open class ConfigurationError : Error {
|
||||
public constructor() : super()
|
||||
public constructor(message: String) : super(message)
|
||||
public constructor(message: String, cause: Throwable) : super(message, cause)
|
||||
public constructor(cause: Throwable) : super(cause)
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api
|
||||
|
||||
public open class ExecutionException : RuntimeException {
|
||||
public constructor() : super()
|
||||
public constructor(message: String) : super(message)
|
||||
public constructor(message: String, cause: Throwable) : super(message, cause)
|
||||
public constructor(cause: Throwable) : super(cause)
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api
|
||||
|
||||
import kotlin.jvm.JvmField
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.RowId
|
||||
|
||||
public class InvalidRowIdError(@JvmField public val badRowId: RowId<*>) : Error("Referenced row was removed from table: $badRowId")
|
@ -1,4 +1,4 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api
|
||||
package ru.landgrafhomyak.db.serdha0.api
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Retention(AnnotationRetention.BINARY)
|
@ -0,0 +1,17 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
public interface Column<RT, DT : DatabaseType<RT>, tUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("name")
|
||||
public val name: String
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("type")
|
||||
public val type: DT
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME", "PropertyName")
|
||||
@get:JvmName("_getOwner")
|
||||
public val _owner: _Selectable<tUE>
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
import kotlin.jvm.JvmField
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.RowId
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
|
||||
@Suppress("ClassName", "RemoveRedundantQualifierName")
|
||||
public interface DatabaseType<@Suppress("unused") RT> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getName")
|
||||
public val name: String
|
||||
|
||||
public abstract class _VirtualType<RT, wRT, wDT : DatabaseType<wRT>>(
|
||||
@JvmField
|
||||
public val wraps: wDT,
|
||||
@JvmField
|
||||
public val allowValuesCaching: Boolean = true
|
||||
) : DatabaseType<RT> {
|
||||
@Suppress("FunctionName")
|
||||
public abstract fun _unwrap(w: wRT): RT
|
||||
|
||||
@Suppress("FunctionName")
|
||||
public abstract fun _wrap(w: RT): wRT
|
||||
|
||||
@Suppress("FunctionName")
|
||||
public abstract fun _equals(l: RT, r: RT): Boolean
|
||||
|
||||
@Suppress("FunctionName")
|
||||
public abstract fun _compare(l: RT, r: RT): Int
|
||||
}
|
||||
|
||||
public interface Nullable<RT : Any, @Suppress("unused") DT : DatabaseType<RT>> : DatabaseType<RT?>
|
||||
|
||||
public interface ROW_ID<ttUE : Any> : DatabaseType<RowId<ttUE>>
|
||||
|
||||
public interface BOOLEAN : DatabaseType<Boolean>
|
||||
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
public interface BINARY_DATA : DatabaseType<UByteArray> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getMaxSizeOrNull")
|
||||
public val maxSizeOrNull: UInt?
|
||||
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("isFixedSize")
|
||||
public val isFixedSize: Boolean
|
||||
}
|
||||
|
||||
public interface Provider {
|
||||
public fun <tUE : Any> ROW_ID(table: Table<tUE, *>): DatabaseType.ROW_ID<tUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME", "PropertyName")
|
||||
@get:JvmName("BOOLEAN")
|
||||
public val BOOLEAN: BOOLEAN
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME", "PropertyName")
|
||||
@get:JvmName("BINARY_DATA")
|
||||
public val BINARY_DATA: BINARY_DATA
|
||||
|
||||
public fun BINARY_DATA(size: UInt, isFixedSize: Boolean): BINARY_DATA
|
||||
|
||||
public fun <RT : Any, DT : DatabaseType<RT>> nullableOf(notNull: DT): Nullable<RT, DT>
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
public interface FiltersScope<oqUE : Any> {
|
||||
public fun <RT : Any, DT : DatabaseType<RT>> filterNotNull(nullable: IntermediateColumn<RT?, DatabaseType.Nullable<RT, DT>, oqUE>): IntermediateColumn<RT, DT, oqUE>
|
||||
|
||||
public fun <RT : Any, DT : DatabaseType<RT>> filterIsNull(nullable: IntermediateColumn<RT?, DatabaseType.Nullable<RT, DT>, oqUE>)
|
||||
|
||||
public enum class ComparisonOperator {
|
||||
EQUALS,
|
||||
NOT_EQUALS,
|
||||
LESS,
|
||||
LESS_OR_EQUALS,
|
||||
GREATER,
|
||||
GREATER_OR_EQUALS,
|
||||
}
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> compareWithParam(column: IntermediateColumn<RT, DT, oqUE>, operator: ComparisonOperator, param: QueryParam<RT, DT, oqUE>)
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> compareWithConstant(column: IntermediateColumn<RT, DT, oqUE>, operator: ComparisonOperator, constant: RT)
|
||||
|
||||
public fun ifTrue(column: IntermediateColumn<Boolean, DatabaseType.BOOLEAN, oqUE>)
|
||||
|
||||
public fun ifFalse(column: IntermediateColumn<Boolean, DatabaseType.BOOLEAN, oqUE>)
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
public interface IntermediateColumn<RT, DT : DatabaseType<RT>, OwnerBuilderUserExtension : Any>
|
@ -0,0 +1,56 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.InputRow
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.OutputRow
|
||||
|
||||
public interface Mapper<mUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: mUE
|
||||
|
||||
public interface InputColumn<RT, DT : DatabaseType<RT>, mUE : Any> : Column<RT, DT, mUE>
|
||||
public interface OutputColumn<RT, DT : DatabaseType<RT>, mUE : Any> : QueryParam<RT, DT, mUE>
|
||||
|
||||
public fun interface InputLinker<mUE : Any, qUE : Any> {
|
||||
public fun link(linker: Scope<mUE, qUE>)
|
||||
|
||||
public interface Scope<mUE : Any, qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: mUE
|
||||
|
||||
public operator fun <RT, DT : DatabaseType<RT>> set(p: InputColumn<RT, DT, mUE>, e: IntermediateColumn<RT, DT, qUE>)
|
||||
}
|
||||
}
|
||||
|
||||
public fun interface OutputLinker<mUE : Any, qUE : Any, oUE : Any> {
|
||||
public fun link(linker: Scope<mUE, qUE>): oUE
|
||||
|
||||
public interface Scope<mUE : Any, qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: mUE
|
||||
|
||||
public operator fun <RT, DT : DatabaseType<RT>> get(p: OutputColumn<RT, DT, mUE>): IntermediateColumn<RT, DT, qUE>
|
||||
}
|
||||
}
|
||||
|
||||
public interface Constructor<mUE : Any> {
|
||||
public fun createMapper(context: Scope<mUE>): Action<mUE>
|
||||
|
||||
public interface Scope<mUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> input(name: String, type: DT): InputColumn<RT, DT, mUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> output(name: String, type: DT): OutputColumn<RT, DT, mUE>
|
||||
}
|
||||
}
|
||||
|
||||
public interface Action<mUE : Any> {
|
||||
public fun calculate(input: OutputRow<mUE>, output: InputRow<mUE>)
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
public interface QueryParam<RT, DT : DatabaseType<RT>, oqUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getName")
|
||||
public val name: String
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getType")
|
||||
public val type: DT
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.InputRow
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.OutputRow
|
||||
|
||||
public interface Reducer<rUE : Any> {
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: rUE
|
||||
|
||||
public interface BidirectionalColumn<RT, DT : DatabaseType<RT>, rUE : Any> : Column<RT, DT, rUE>, QueryParam<RT, DT, rUE>
|
||||
public interface OutputColumn<RT, DT : DatabaseType<RT>, rUE : Any> : Column<RT, DT, rUE>, QueryParam<RT, DT, rUE>
|
||||
|
||||
|
||||
public fun interface Linker<_rUE : Any, qUE : Any, oUE : Any> {
|
||||
public fun link(linker: Scope<_rUE, qUE>): oUE
|
||||
|
||||
public interface Scope<rUE : Any, qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: rUE
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> link(red: BidirectionalColumn<RT, DT, rUE>, src: IntermediateColumn<RT, DT, qUE>): IntermediateColumn<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> linkAndInitialize(red: BidirectionalColumn<RT, DT, rUE>, src: IntermediateColumn<RT, DT, qUE>, initial: RT): IntermediateColumn<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> linkAndInitialize(red: BidirectionalColumn<RT, DT, rUE>, src: IntermediateColumn<RT, DT, qUE>, initial: QueryParam<RT, DT, qUE>): IntermediateColumn<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> link(red: OutputColumn<RT, DT, rUE>): IntermediateColumn<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> linkAndInitialize(red: OutputColumn<RT, DT, rUE>, initial: RT): IntermediateColumn<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> linkAndInitialize(red: OutputColumn<RT, DT, rUE>, initial: QueryParam<RT, DT, qUE>): IntermediateColumn<RT, DT, qUE>
|
||||
}
|
||||
}
|
||||
|
||||
public interface Constructor<rUE : Any> {
|
||||
public fun createReducer(context: Scope<rUE>): Action<rUE>
|
||||
|
||||
public interface Scope<rUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> outputColumn(name: String, type: DT): OutputColumn<RT, DT, rUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> outputColumn(name: String, type: DT, defaultInitialValue: RT): OutputColumn<RT, DT, rUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> bidirectionalColumn(name: String, type: DT): BidirectionalColumn<RT, DT, rUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> bidirectionalColumn(name: String, type: DT, defaultInitialValue: RT): BidirectionalColumn<RT, DT, rUE>
|
||||
}
|
||||
}
|
||||
|
||||
public interface Action<rUE : Any> {
|
||||
public fun calculate(acc: OutputRow<rUE>, row: OutputRow<rUE>, newAcc: InputRow<rUE>)
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries._Query
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.OutputRow
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.Transaction
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.RowId
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
|
||||
public interface RowExpression<ttUE : Any, @Suppress("unused") R> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getTargetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
|
||||
public interface RowExportsConstructor<rUE : Any, ttUE : Any> {
|
||||
public fun createRowExports(context: Scope<rUE, ttUE>): rUE
|
||||
|
||||
public interface Scope<rUE : Any, ttUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> selectFromTargetTable(column: Column<RT, DT, ttUE>): Column<RT, DT, rUE>
|
||||
|
||||
public fun <rtUE : Any, RT, DT : DatabaseType<RT>> followReference(
|
||||
ref: Column<*, *, rUE>,
|
||||
column: Column<RT, DT, rtUE>
|
||||
): Column<RT, DT, rUE>
|
||||
|
||||
public fun <rtUE : Any, RT : Any, DT : DatabaseType<RT>> followReferenceNullable(
|
||||
ref: Column<RowId<rtUE>, DatabaseType.ROW_ID<rtUE>, rUE>,
|
||||
column: Column<RT, DT, rtUE>
|
||||
): Column<RT?, DatabaseType.Nullable<RT, DT>, rUE>
|
||||
}
|
||||
}
|
||||
|
||||
public interface Constructor<ttUE : Any, rUE : Any, R> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rowExports")
|
||||
public val rowExports: RowExportsConstructor<rUE, ttUE>
|
||||
|
||||
public fun createRowExpression(internalQueries: _Query.Constructor._SelectsScope, runtimeQueries: _Query.Constructor._SelectsScope): Action<rUE, R>
|
||||
}
|
||||
|
||||
public interface Action<rUE : Any, R> {
|
||||
public suspend fun calculateRow(rowUE: rUE, row: OutputRow<rUE>, transaction: Transaction): R
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.misc
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries.SelectQuery
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries.InsertQuery
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries.UpdateQuery
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries.DeleteQuery
|
||||
|
||||
|
||||
/**
|
||||
* Utility interface to mark queries (and table) that can be used as the source for other queries.
|
||||
*
|
||||
* @param UE Type of extension provided by user ([about user extensions](https://git.landgrafhomyak.ru/SERDHA/serdha-0-api.kt/wiki/User-extensions)).
|
||||
*
|
||||
* @see SelectQuery
|
||||
* @see InsertQuery.FromSubquery.Constructor.selector
|
||||
* @see UpdateQuery.FromSubquery.Constructor.selector
|
||||
* @see DeleteQuery.FromSubquery.Constructor.selector
|
||||
*/
|
||||
@Suppress("ClassName")
|
||||
public interface _Selectable<out UE : Any> {
|
||||
/**
|
||||
* Getter of an extension provided by user ([about user extensions](https://git.landgrafhomyak.ru/SERDHA/serdha-0-api.kt/wiki/User-extensions)).
|
||||
*/
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: UE
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.module
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries._Query
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.Executor
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.Transaction
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.TableConstructor
|
||||
|
||||
|
||||
public interface CreateModuleScope {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rootNs")
|
||||
public val rootNs: Namespace
|
||||
|
||||
public fun <tUE : Any> createTable(namespace: Namespace = this.rootNs, name: String, initializer: TableConstructor<tUE>): Table<tUE, Nothing>
|
||||
|
||||
public fun <tUE : Any> createSessionScopeTemporaryTable(namespace: Namespace = this.rootNs, name: String, initializer: TableConstructor<tUE>): Table<tUE, Nothing>
|
||||
|
||||
public fun <tUE : Any> createTransactionScopeTemporaryTable(namespace: Namespace = this.rootNs, name: String, initializer: TableConstructor<tUE>): Table<tUE, Nothing>
|
||||
|
||||
public fun <tUE : Any> createModuleConfiguringScopeTemporaryTable(namespace: Namespace = this.rootNs, name: String, initializer: TableConstructor<tUE>): Table<tUE, Nothing>
|
||||
|
||||
public fun <R : Any> createQuery(creator: _Query.Constructor<R>): R
|
||||
|
||||
public fun <R : Any> createModuleConfiguringScopeTemporaryQuery(creator: _Query.Constructor<R>): R
|
||||
|
||||
public fun <mUE : Any> substituteModule(rootNs: Namespace, template: ModuleTemplate<mUE>): Module<mUE>
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.module
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries._Query
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.Executor
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.TableConstructor
|
||||
|
||||
|
||||
public interface Module<mUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: mUE
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getVersionKey")
|
||||
public val versionKey: String
|
||||
|
||||
public fun <R : Any> createQuery(c: _Query.Constructor<R>): R
|
||||
|
||||
public fun <tUE : Any> createSessionScopeTemporaryTable(name: String, initializer: TableConstructor<tUE>): Table<tUE, Nothing>
|
||||
|
||||
public fun <tUE : Any> createTransactionScopeTemporaryTable(name: String, initializer: TableConstructor<tUE>): Table<tUE, Nothing>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("executor")
|
||||
public val executor: Executor
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.module
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.Transaction
|
||||
|
||||
public interface ModuleTemplate<@Suppress("unused") mUE : Any> {
|
||||
public interface VersionsInitializer<UE : Any> {
|
||||
public fun createModuleTemplates(context: Scope): UE
|
||||
|
||||
public interface Scope {
|
||||
public fun <nmUE : Any> createTemplate(
|
||||
constructor: ModuleConstructor<nmUE>,
|
||||
): ModuleTemplate<nmUE>
|
||||
|
||||
public fun <omUE : Any, nmUE : Any> upgradeTemplate(
|
||||
oldModule: ModuleTemplate<omUE>,
|
||||
upgrade: ModuleUpgrade<omUE, nmUE>,
|
||||
): ModuleTemplate<nmUE>
|
||||
|
||||
public fun <omUE : Any, nmUE : Any> upgradeTemplateAndMerge(
|
||||
oldModule: ModuleTemplate<omUE>,
|
||||
upgrade: ModuleUpgrade<omUE, nmUE>,
|
||||
mergeTo: ModuleTemplate<nmUE>
|
||||
): ModuleTemplate<nmUE>
|
||||
}
|
||||
}
|
||||
|
||||
public interface ModuleConstructor<mUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("versionKey")
|
||||
public val versionKey: String
|
||||
|
||||
public fun createSchema(context: CreateModuleScope): mUE
|
||||
|
||||
public suspend fun initData(ext: mUE, transaction: Transaction) {}
|
||||
}
|
||||
|
||||
public interface ModuleUpgrade<omUE : Any, nmUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("versionKey")
|
||||
public val versionKey: String
|
||||
|
||||
public fun upgradeSchema(context: UpgradeModuleScope<omUE>): nmUE
|
||||
|
||||
public suspend fun upgradeData(ext: nmUE, transaction: Transaction) {}
|
||||
}
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getVersionKey")
|
||||
public val versionKey: String
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.module
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
public interface Namespace {
|
||||
@Suppress("SpellCheckingInspection")
|
||||
public fun subnamespace(name: String): Namespace
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getName")
|
||||
public val name: String
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME", "PropertyName")
|
||||
@get:JvmName("_getPath")
|
||||
public val _path: List<String>
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.module
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.TableConstructor
|
||||
|
||||
|
||||
public interface UpgradeModuleScope<omUE : Any> : CreateModuleScope {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("oldModule")
|
||||
public val oldModule: omUE
|
||||
|
||||
public interface TableUpgrade<tnUE : Any, toUE : Any> {
|
||||
public fun upgradeTable(oldTable: Table<toUE, *>, upgrade: TableUpgrade<tnUE, toUE>): tnUE
|
||||
}
|
||||
|
||||
|
||||
public fun <tUE : Any> keepTable(
|
||||
table: Table<tUE, *>,
|
||||
): Table<tUE, *>
|
||||
|
||||
public fun <tUE : Any> renameTable(
|
||||
table: Table<tUE, *>,
|
||||
newNamespace: Namespace? = null,
|
||||
newName: String? = null
|
||||
): Table<tUE, *>
|
||||
|
||||
public fun <tnUE : Any, toUE : Any> upgradeTable(
|
||||
oldTable: Table<toUE, *>,
|
||||
upgrade: TableUpgrade<tnUE, toUE>
|
||||
): Table<tnUE, toUE>
|
||||
|
||||
|
||||
public fun <tnUE : Any, toUE : Any> upgradeAndRenameTable(
|
||||
oldTable: Table<tnUE, toUE>,
|
||||
newNamespace: Namespace? = null,
|
||||
newName: String? = null,
|
||||
upgrade: TableUpgrade<tnUE, toUE>
|
||||
): Table<tnUE, toUE>
|
||||
|
||||
public fun deleteTable(table: Table<*, *>)
|
||||
|
||||
public fun deleteTableAfterModuleUpgraded(table: Table<*, *>)
|
||||
|
||||
public fun <smUE : Any> upgradeModule(oldModule: Module<*>, rootNs: Namespace, template: ModuleTemplate<smUE>): Module<smUE>
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.queries
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.QueryParam
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc._Selectable
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.InputRow
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.RowId
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
|
||||
public interface DeleteQuery<out qUE : Any> : _Query<qUE> {
|
||||
public interface SingleRow<out qUE : Any> : DeleteQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any> : _Query.Constructor<SingleRow<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): SingleRow<qUE> =
|
||||
outQueries.deleteSingleRow(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("targetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
|
||||
public fun createDeleteSingleRowWithReturning(context: Scope<qUE, ttUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
public fun <RT, DT : DatabaseType<RT>> queryParam(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rowToRemove")
|
||||
public val rowToRemove: QueryParam<RowId<ttUE>, DatabaseType.ROW_ID<ttUE>, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> returnRemovedValue(name: String, column: Column<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnParam(name: String, column: QueryParam<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
|
||||
public fun ifNoRowSkip()
|
||||
public fun ifNoRowJustReturn()
|
||||
public fun ifNoRowThrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface FromSubquery<out qUE : Any> : DeleteQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any, sUE : Any> : _Query.Constructor<FromSubquery<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): FromSubquery<qUE> =
|
||||
outQueries.deleteFromSubquery(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rowToRemove")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("selector")
|
||||
public val selector: _Selectable<sUE>
|
||||
|
||||
public fun createDeleteFromSubqueryWithReturning(context: Scope<qUE, ttUE, sUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any, sUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("src")
|
||||
public val src: _Selectable<sUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
public fun <RT, DT : DatabaseType<RT>> queryParam(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("selectorParams")
|
||||
public val selectorParams: InputRow.WithRedirect<sUE, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("_getSelectorColumn")
|
||||
@set:JvmName("selectorColumn")
|
||||
public var selectorColumn: Column<RowId<ttUE>, DatabaseType.ROW_ID<ttUE>, sUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> returnFromSubquery(name: String, column: Column<RT, DT, sUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnRemovedValue(name: String, column: Column<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnParam(name: String, column: QueryParam<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
|
||||
public fun ifNoRowSkip()
|
||||
public fun ifNoRowJustReturn()
|
||||
public fun ifNoRowThrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface MultipleRows<out qUE : Any> : DeleteQuery<qUE>, _Query.Table2Void<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any> : _Query.Constructor<MultipleRows<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): MultipleRows<qUE> =
|
||||
outQueries.deleteMultipleRows(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("targetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
|
||||
public fun createMultipleRows(context: Scope<qUE, ttUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rowsToRemove")
|
||||
public val rowsToRemove: QueryParam<RowId<ttUE>, DatabaseType.ROW_ID<ttUE>, qUE>
|
||||
|
||||
public fun ifNoRowSkip()
|
||||
public fun ifNoRowThrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.queries
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.QueryParam
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc._Selectable
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.InputRow
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.UniqueIndex
|
||||
|
||||
public interface InsertQuery<out qUE : Any> : _Query<qUE> {
|
||||
@Suppress("ClassName")
|
||||
public interface _UpsertClauseScope<qUE : Any, tUE : Any> {
|
||||
public fun keepColumn(column: Column<*, *, tUE>)
|
||||
public fun overrideColumn(column: Column<*, *, tUE>)
|
||||
public fun <RT, DT : DatabaseType<RT>> setFromParam(dst: Column<RT, DT, qUE>, src: QueryParam<RT, DT, qUE>)
|
||||
public fun <RT> setConstant(dst: Column<RT, *, qUE>, src: RT)
|
||||
}
|
||||
|
||||
@Suppress("ClassName")
|
||||
public interface _CommonInsertCreatorScope<qUE : Any, ttUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
|
||||
public fun onConflictUpdate(u: UniqueIndex<ttUE>, c: (_UpsertClauseScope<qUE, ttUE>) -> Unit)
|
||||
public fun onConflictThrow(u: UniqueIndex<ttUE>)
|
||||
public fun onConflictSkip(u: UniqueIndex<ttUE>)
|
||||
}
|
||||
|
||||
|
||||
public interface SingleRow<out qUE : Any> : InsertQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any> : _Query.Constructor<SingleRow<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): SingleRow<qUE> =
|
||||
outQueries.insertSingleRow(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("targetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
|
||||
public fun createInsertSingleRowWithReturning(context: Scope<qUE, ttUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any> : _CommonInsertCreatorScope<qUE, ttUE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> queryParam(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> insertConstant(dst: Column<RT, DT, ttUE>, src: RT)
|
||||
public fun <RT, DT : DatabaseType<RT>> insertParam(dst: Column<RT, DT, ttUE>, src: QueryParam<RT, DT, qUE>)
|
||||
|
||||
public fun onConflictReturnOnly(u: UniqueIndex<ttUE>)
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> returnInsertedValue(name: String, c: Column<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnParam(name: String, c: QueryParam<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface FromSubquery<out qUE : Any> : InsertQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any, sUE : Any> : _Query.Constructor<FromSubquery<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): FromSubquery<qUE> =
|
||||
outQueries.insertFromSubquery(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("targetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("selector")
|
||||
public val selector: _Selectable<sUE>
|
||||
|
||||
public fun createInsertSingleRowWithReturning(context: Scope<qUE, ttUE, sUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any, sUE : Any> : _CommonInsertCreatorScope<qUE, ttUE> {
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("src")
|
||||
public val src: _Selectable<sUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> queryParam(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("sourceQueryParams")
|
||||
public val sourceQueryParams: InputRow.WithRedirect<sUE, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> insertConstant(dst: Column<RT, DT, ttUE>, src: RT)
|
||||
public fun <RT, DT : DatabaseType<RT>> insertParam(dst: Column<RT, DT, ttUE>, src: QueryParam<RT, DT, qUE>)
|
||||
public fun <RT, DT : DatabaseType<RT>> insertFromSubquery(dst: Column<RT, DT, ttUE>, src: Column<RT, DT, sUE>)
|
||||
|
||||
public fun onConflictReturnOnly(u: UniqueIndex<ttUE>)
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> returnFromSubquery(name: String, column: Column<RT, DT, sUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnInsertedValue(name: String, column: Column<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnParam(name: String, param: QueryParam<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface MultipleRows<out qUE : Any> : InsertQuery<qUE>, _Query.Table2Void<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any> : _Query.Constructor<MultipleRows<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): MultipleRows<qUE> =
|
||||
outQueries.insertMultipleRows(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("targetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
public fun createInsertMultipleRows(context: Scope<qUE, ttUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any> : _CommonInsertCreatorScope<qUE, ttUE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> inputColumn(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> insertColumn(dst: Column<RT, DT, ttUE>, src: QueryParam<RT, DT, qUE>)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,260 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.queries
|
||||
|
||||
import kotlin.jvm.JvmField
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.IntermediateColumn
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Mapper
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.FiltersScope
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.QueryParam
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Reducer
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc._Selectable
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.InputRow
|
||||
|
||||
public interface SelectQuery<out qUE : Any> : _Query<qUE> {
|
||||
public enum class Order {
|
||||
ASC, DESC
|
||||
}
|
||||
|
||||
public abstract class JoinType {
|
||||
public class LeftJoin(
|
||||
@JvmField
|
||||
public val leftNull: Null,
|
||||
@JvmField
|
||||
public val behaviour: Behaviour
|
||||
) : JoinType() {
|
||||
@Suppress("ClassName")
|
||||
public abstract class Null {
|
||||
public object NULL_NOT_EXPECTED : Null()
|
||||
public object AS_ID : Null()
|
||||
public object SKIP : Null()
|
||||
public object JOIN_TO_NULL : Null()
|
||||
}
|
||||
|
||||
@Suppress("ClassName")
|
||||
public abstract class Behaviour {
|
||||
public object LEFT_TO_UNIQUE_RIGHT : Behaviour()
|
||||
public object LEFT_TO_UNIQUE_RIGHT_OR_TO_NULL : Behaviour()
|
||||
public object LEFT_FOR_EACH_RIGHT : Behaviour()
|
||||
public object LEFT_FOR_EACH_RIGHT_OR_TO_NULL : Behaviour()
|
||||
}
|
||||
}
|
||||
|
||||
public object CrossJoin : JoinType()
|
||||
}
|
||||
|
||||
@Suppress("ClassName")
|
||||
public interface _CommonSelectCreatorScope<qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
public fun <RT, DT : DatabaseType<RT>> queryParam(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> paramAsColumn(param: QueryParam<RT, DT, qUE>): IntermediateColumn<RT, DT, qUE>
|
||||
|
||||
public fun <mUE : Any> createMapper(constructor: Mapper.Constructor<mUE>): Mapper<mUE>
|
||||
public fun <mUE : Any, oUE : Any> mapColumns(
|
||||
mapper: Mapper<mUE>,
|
||||
input: Mapper.InputLinker<mUE, qUE>,
|
||||
output: Mapper.OutputLinker<mUE, qUE, oUE>
|
||||
): oUE
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("filters")
|
||||
public val filters: FiltersScope<qUE>
|
||||
public fun orderBy(order: Order, vararg column: IntermediateColumn<*, *, qUE>)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("_getLimit")
|
||||
@set:JvmName("limit")
|
||||
public var limit: UInt
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("_getOffset")
|
||||
@set:JvmName("offset")
|
||||
public var offset: ULong
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> returnParam(name: String, param: QueryParam<RT, DT, qUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnColumn(name: String, column: IntermediateColumn<RT, DT, qUE>): Column<RT, DT, qUE>
|
||||
}
|
||||
|
||||
public interface Simple<out qUE : Any> : SelectQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, tUE : Any> : _Query.Constructor<Simple<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): Simple<qUE> =
|
||||
outQueries.select(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("source")
|
||||
public val source: _Selectable<tUE>
|
||||
|
||||
public fun createSelect(context: Scope<qUE, tUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, tUE : Any> : _CommonSelectCreatorScope<qUE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("src")
|
||||
public val src: _Selectable<tUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("subqueryParams")
|
||||
public val subqueryParams: InputRow.WithRedirect<tUE, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> selectColumnFromSubquery(param: Column<RT, DT, tUE>): IntermediateColumn<RT, DT, qUE>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface WithJoin<out qUE : Any> : SelectQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, lsqUE : Any, rsqUE : Any> : _Query.Constructor<WithJoin<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): WithJoin<qUE> =
|
||||
outQueries.selectWithJoin(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("left")
|
||||
public val left: _Selectable<lsqUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("right")
|
||||
public val right: _Selectable<rsqUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("joinType")
|
||||
public val joinType: JoinType
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("leftColumnToJoin")
|
||||
public val leftColumnToJoin: Column<*, *, lsqUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rightColumnToJoin")
|
||||
public val rightColumnToJoin: Column<*, *, rsqUE>
|
||||
|
||||
public fun createSelectWithJoin(context: Scope<qUE, lsqUE, rsqUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, lsqUE : Any, rsqUE : Any> : _CommonSelectCreatorScope<qUE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("lsq")
|
||||
public val lsq: _Selectable<lsqUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rsq")
|
||||
public val rsq: _Selectable<rsqUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("leftSubqueryParams")
|
||||
public val leftSubqueryParams: InputRow.WithRedirect<lsqUE, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rightSubqueryParams")
|
||||
public val rightSubqueryParams: InputRow.WithRedirect<rsqUE, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> selectColumnFromLeft(column: Column<RT, DT, lsqUE>): IntermediateColumn<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> selectColumnFromRight(column: Column<RT, DT, rsqUE>): IntermediateColumn<RT, DT, qUE>
|
||||
public fun <RT : Any, DT : DatabaseType<RT>> selectColumnFromRightAsNullable(column: Column<RT, DT, rsqUE>): IntermediateColumn<RT?, DatabaseType.Nullable<RT, DT>, qUE>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Reducing<out qUE : Any> : SelectQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, tUE : Any> : _Query.Constructor<Reducing<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): Reducing<qUE> =
|
||||
outQueries.selectReducing(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("source")
|
||||
public val source: _Selectable<tUE>
|
||||
|
||||
public fun createSelectWithReduce(context: Scope<qUE, tUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, tUE : Any> : _CommonSelectCreatorScope<qUE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("src")
|
||||
public val src: _Selectable<tUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("sourceParams")
|
||||
public val sourceParams: InputRow.WithRedirect<tUE, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> selectColumnFromSubquery(param: Column<RT, DT, tUE>): IntermediateColumn<RT, DT, qUE>
|
||||
|
||||
public fun <rUE : Any> createReducer(constructor: Reducer.Constructor<rUE>): Reducer<rUE>
|
||||
public fun <mUE : Any, oUE : Any> reduceRows(
|
||||
reducer: Reducer<mUE>,
|
||||
linker: Reducer.Linker<mUE, qUE, oUE>,
|
||||
): oUE
|
||||
|
||||
public fun groupBy(vararg columns: IntermediateColumn<*, *, qUE>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Folding<out qUE : Any> : SelectQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, tUE : Any> : _Query.Constructor<Folding<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): Folding<qUE> =
|
||||
outQueries.selectFolding(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("source")
|
||||
public val source: _Selectable<tUE>
|
||||
|
||||
public fun createSelectWithFold(context: Scope<qUE, tUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, tUE : Any> : _CommonSelectCreatorScope<qUE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("src")
|
||||
public val src: _Selectable<tUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("sourceParams")
|
||||
public val sourceParams: InputRow.WithRedirect<tUE, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> selectColumnFromSubquery(param: Column<RT, DT, tUE>): IntermediateColumn<RT, DT, qUE>
|
||||
|
||||
public fun <rUE : Any> createReducer(constructor: Reducer.Constructor<rUE>): Reducer<rUE>
|
||||
public fun <mUE : Any, oUE : Any> foldRows(
|
||||
reducer: Reducer<mUE>,
|
||||
linker: Reducer.Linker<mUE, qUE, oUE>,
|
||||
): oUE
|
||||
|
||||
public fun groupBy(vararg columns: IntermediateColumn<*, *, qUE>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface Union<out qUE : Any> : SelectQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, fqUE : Any, lqUE : Any> : _Query.Constructor<Union<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): Union<qUE> =
|
||||
outQueries.selectUnion(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("first")
|
||||
public val first: _Selectable<fqUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("last")
|
||||
public val last: _Selectable<lqUE>
|
||||
|
||||
public fun createSelectWithJoin(context: Scope<qUE, fqUE, lqUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, fqUE : Any, lqUE : Any> : _CommonSelectCreatorScope<qUE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("fq")
|
||||
public val fq: _Selectable<fqUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("lq")
|
||||
public val lq: _Selectable<lqUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("firstSubqueryParams")
|
||||
public val firstSubqueryParams: InputRow.WithRedirect<fqUE, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("lastSubqueryParams")
|
||||
public val lastSubqueryParams: InputRow.WithRedirect<lqUE, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> uniteColumns(first: Column<RT, DT, fqUE>, last: Column<RT, DT, lqUE>): IntermediateColumn<RT, DT, qUE>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.queries
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.QueryParam
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc._Selectable
|
||||
import ru.landgrafhomyak.db.serdha0.api.runtime.InputRow
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.RowId
|
||||
|
||||
public interface UpdateQuery<out qUE : Any> : _Query<qUE> {
|
||||
public interface SingleRow<out qUE : Any> : UpdateQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any> : _Query.Constructor<SingleRow<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): SingleRow<qUE> =
|
||||
outQueries.updateSingleRow(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("targetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
public fun createUpdateSingleWithReturning(context: Scope<qUE, ttUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
public fun <RT, DT : DatabaseType<RT>> queryParam(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rowToUpdate")
|
||||
public val rowToUpdate: QueryParam<RowId<ttUE>, DatabaseType.ROW_ID<ttUE>, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> updateColumnWithOldValue(dst: Column<RT, DT, ttUE>, src: Column<RT, DT, ttUE>)
|
||||
public fun <RT, DT : DatabaseType<RT>> updateColumnWithParam(dst: Column<RT, DT, ttUE>, src: QueryParam<RT, DT, qUE>)
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> returnOldValue(name: String, column: Column<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnNewValue(name: String, column: Column<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnParam(name: String, param: QueryParam<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
|
||||
public fun ifNoRowSkip()
|
||||
public fun ifNoRowJustReturn()
|
||||
public fun ifNoRowThrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface FromSubquery<out qUE : Any> : UpdateQuery<qUE>, _Query.Params2Table<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any, sUE : Any> : _Query.Constructor<FromSubquery<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): FromSubquery<qUE> =
|
||||
outQueries.updateFromSubquery(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("targetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("selector")
|
||||
public val selector: _Selectable<sUE>
|
||||
|
||||
public fun createUpdateFromSubqueryWithReturning(context: Scope<qUE, ttUE, sUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any, sUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("src")
|
||||
public val src: _Selectable<sUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
public fun <RT, DT : DatabaseType<RT>> queryParam(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("selectorParams")
|
||||
public val selectorParams: InputRow.WithRedirect<sUE, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("_getSelectorColumn")
|
||||
@set:JvmName("selectorColumn")
|
||||
public var selectorColumn: Column<RowId<ttUE>, DatabaseType.ROW_ID<ttUE>, sUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> updateColumnWithSubquery(dst: Column<RT, DT, ttUE>, src: Column<RT, DT, sUE>)
|
||||
public fun <RT, DT : DatabaseType<RT>> updateColumnWithOldValue(dst: Column<RT, DT, ttUE>, src: Column<RT, DT, ttUE>)
|
||||
public fun <RT, DT : DatabaseType<RT>> updateColumnWithParam(dst: Column<RT, DT, ttUE>, src: QueryParam<RT, DT, qUE>)
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> returnFromSubquery(name: String, column: Column<RT, DT, sUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnOldValue(name: String, column: Column<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnNewValue(name: String, column: Column<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> returnParam(name: String, param: QueryParam<RT, DT, ttUE>): Column<RT, DT, qUE>
|
||||
|
||||
public fun ifNoRowSkip()
|
||||
public fun ifNoRowJustReturn()
|
||||
public fun ifNoRowThrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface MultipleRows<out qUE : Any> : UpdateQuery<qUE>, _Query.Table2Void<qUE> {
|
||||
public interface Constructor<qUE : Any, ttUE : Any> : _Query.Constructor<MultipleRows<qUE>> {
|
||||
override fun createQuery(internalQueries: _Query.Constructor.Scope, outQueries: _Query.Constructor.Scope): MultipleRows<qUE> =
|
||||
outQueries.updateMultipleRows(this)
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("targetTable")
|
||||
public val targetTable: Table<ttUE, *>
|
||||
public fun createUpdateMultipleRows(context: Scope<qUE, ttUE>): qUE
|
||||
|
||||
public interface Scope<qUE : Any, ttUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("tt")
|
||||
public val tt: Table<ttUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
public fun <RT, DT : DatabaseType<RT>> inputColumn(name: String, type: DT): QueryParam<RT, DT, qUE>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rowToUpdate")
|
||||
public val rowToUpdate: QueryParam<RowId<ttUE>, DatabaseType.ROW_ID<ttUE>, qUE>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> updateColumnWithOldValue(dst: Column<RT, DT, ttUE>, src: Column<RT, DT, ttUE>)
|
||||
public fun <RT, DT : DatabaseType<RT>> updateColumnWithParam(dst: Column<RT, DT, ttUE>, src: QueryParam<RT, DT, qUE>)
|
||||
|
||||
public fun ifNoRowSkip()
|
||||
public fun ifNoRowThrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.queries
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc._Selectable
|
||||
|
||||
|
||||
@Suppress("ClassName")
|
||||
public interface _Query<out qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: qUE
|
||||
|
||||
public interface Table2Void<out qUE : Any> : _Query<qUE>
|
||||
public interface Params2Void<out qUE : Any> : _Query<qUE>
|
||||
public interface Params2Table<out qUE : Any> : _Query<qUE>, _Selectable<qUE>
|
||||
public interface Void2Table<out qUE : Any> : _Query<qUE>, _Selectable<qUE>
|
||||
|
||||
public interface Constructor<R> {
|
||||
public fun createQuery(internalQueries: Scope, outQueries: Scope): R
|
||||
|
||||
public interface _SelectsScope {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@JvmName("_composite")
|
||||
public operator fun <R> invoke(constructor: Constructor<R>): R
|
||||
|
||||
public fun <qUE : Any, sqUE : Any> select(constructor: SelectQuery.Simple.Constructor<qUE, sqUE>): SelectQuery.Simple<qUE>
|
||||
public fun <qUE : Any, lUE : Any, rUE : Any> selectWithJoin(constructor: SelectQuery.WithJoin.Constructor<qUE, lUE, rUE>): SelectQuery.WithJoin<qUE>
|
||||
public fun <qUE : Any, sqUE : Any> selectReducing(constructor: SelectQuery.Reducing.Constructor<qUE, sqUE>): SelectQuery.Reducing<qUE>
|
||||
public fun <qUE : Any, sqUE : Any> selectFolding(constructor: SelectQuery.Folding.Constructor<qUE, sqUE>): SelectQuery.Folding<qUE>
|
||||
public fun <qUE : Any, fqUE : Any, lqUE : Any> selectUnion(constructor: SelectQuery.Union.Constructor<qUE, fqUE, lqUE>): SelectQuery.Union<qUE>
|
||||
}
|
||||
|
||||
public interface Scope : _SelectsScope {
|
||||
public fun <qUE : Any, ttUE : Any> insertSingleRow(constructor: InsertQuery.SingleRow.Constructor<qUE, ttUE>): InsertQuery.SingleRow<qUE>
|
||||
public fun <qUE : Any, ttUE : Any, sUE : Any> insertFromSubquery(constructor: InsertQuery.FromSubquery.Constructor<qUE, ttUE, sUE>): InsertQuery.FromSubquery<qUE>
|
||||
public fun <qUE : Any, ttUE : Any> insertMultipleRows(constructor: InsertQuery.MultipleRows.Constructor<qUE, ttUE>): InsertQuery.MultipleRows<qUE>
|
||||
|
||||
public fun <qUE : Any, ttUE : Any> updateSingleRow(constructor: UpdateQuery.SingleRow.Constructor<qUE, ttUE>): UpdateQuery.SingleRow<qUE>
|
||||
public fun <qUE : Any, ttUE : Any, sUE : Any> updateFromSubquery(constructor: UpdateQuery.FromSubquery.Constructor<qUE, ttUE, sUE>): UpdateQuery.FromSubquery<qUE>
|
||||
public fun <qUE : Any, ttUE : Any> updateMultipleRows(constructor: UpdateQuery.MultipleRows.Constructor<qUE, ttUE>): UpdateQuery.MultipleRows<qUE>
|
||||
|
||||
public fun <qUE : Any, ttUE : Any> deleteSingleRow(constructor: DeleteQuery.SingleRow.Constructor<qUE, ttUE>): DeleteQuery.SingleRow<qUE>
|
||||
public fun <qUE : Any, ttUE : Any, sUE : Any> deleteFromSubquery(constructor: DeleteQuery.FromSubquery.Constructor<qUE, ttUE, sUE>): DeleteQuery.FromSubquery<qUE>
|
||||
public fun <qUE : Any, ttUE : Any> deleteMultipleRows(constructor: DeleteQuery.MultipleRows.Constructor<qUE, ttUE>): DeleteQuery.MultipleRows<qUE>
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.runtime
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.serdha0.api.module.Module
|
||||
import ru.landgrafhomyak.db.serdha0.api.module.ModuleTemplate
|
||||
|
||||
@LowLevelApi
|
||||
public interface DatabaseConnection {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public fun <UE : Any> _createModuleTemplates(x: ModuleTemplate.VersionsInitializer<UE>): UE
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public fun <mUE : Any> _setRootModuleAndLockSchema(t: ModuleTemplate<mUE>): Module<mUE>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public fun _finishSetup()
|
||||
|
||||
@Suppress("PropertyName", "INAPPLICABLE_JVM_NAME")
|
||||
@LowLevelApi
|
||||
@get:JvmName("_getExecutor")
|
||||
public val _executor: Executor
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.runtime
|
||||
|
||||
import ru.landgrafhomyak.db.serdha0.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.serdha0.api.module.Module
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.RowId
|
||||
import ru.landgrafhomyak.db.serdha0.api.table.Table
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries._Query
|
||||
|
||||
public interface Executor {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _startTransaction(): Transaction
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <QueryUserExtension : Any> _executeAutoTransactedQuery(compiledQuery: _Query.Void2Table<QueryUserExtension>): OutputRow._Iterator<QueryUserExtension, Unit>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <QueryUserExtension : Any> _executeAutoTransactedQuery(compiledQuery: _Query.Params2Table<QueryUserExtension>): InputRow._Scope<QueryUserExtension, OutputRow._Iterator<QueryUserExtension, Unit>>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <QueryUserExtension : Any> _executeAutoTransactedQuery(compiledQuery: _Query.Table2Void<QueryUserExtension>): InputRow._Iterator<QueryUserExtension, Unit>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <QueryUserExtension : Any> _executeAutoTransactedQuery(compiledQuery: _Query.Params2Void<QueryUserExtension>): InputRow._Scope<QueryUserExtension, Unit>
|
||||
|
||||
public fun <TableUserException : Any, V> mapOfRowIds(
|
||||
table: Table<TableUserException, *>,
|
||||
builder: (MutableMap<OutputRow<TableUserException>, V>) -> Unit
|
||||
): Map<RowId<TableUserException>, V>
|
||||
|
||||
public fun <TableUserException : Any, V> mutableMapOfRowIds(table: Table<TableUserException, *>): MutableMap<RowId<TableUserException>, V>
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.runtime
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.QueryParam
|
||||
|
||||
public interface InputRow<qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: qUE
|
||||
|
||||
public operator fun <RuntimeType> set(c: QueryParam<RuntimeType, *, qUE>, value: RuntimeType)
|
||||
|
||||
public operator fun set(c: QueryParam<Byte, *, qUE>, value: Byte): Unit = this.set<Byte>(c, value)
|
||||
public operator fun set(c: QueryParam<UByte, *, qUE>, value: UByte): Unit = this.set<UByte>(c, value)
|
||||
public operator fun set(c: QueryParam<Short, *, qUE>, value: Short): Unit = this.set<Short>(c, value)
|
||||
public operator fun set(c: QueryParam<UShort, *, qUE>, value: UShort): Unit = this.set<UShort>(c, value)
|
||||
public operator fun set(c: QueryParam<Int, *, qUE>, value: Int): Unit = this.set<Int>(c, value)
|
||||
public operator fun set(c: QueryParam<UInt, *, qUE>, value: UInt): Unit = this.set<UInt>(c, value)
|
||||
public operator fun set(c: QueryParam<Long, *, qUE>, value: Long): Unit = this.set<Long>(c, value)
|
||||
public operator fun set(c: QueryParam<ULong, *, qUE>, value: ULong): Unit = this.set<ULong>(c, value)
|
||||
public operator fun set(c: QueryParam<Char, *, qUE>, value: Char): Unit = this.set<Char>(c, value)
|
||||
public operator fun set(c: QueryParam<Boolean, *, qUE>, value: Boolean): Unit = this.set<Boolean>(c, value)
|
||||
|
||||
public interface WithRedirect<QueryUserExtension : Any, ParentQueryUserExtension : Any> : InputRow<QueryUserExtension> {
|
||||
public fun <RT, DT : DatabaseType<RT>> redirect(c: QueryParam<RT, DT, QueryUserExtension>, value: QueryParam<RT, DT, ParentQueryUserExtension>)
|
||||
}
|
||||
|
||||
@Suppress("ClassName")
|
||||
@LowLevelApi
|
||||
public interface _Scope<QueryUserExtension : Any, out Next> : InputRow<QueryUserExtension> {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _finish(): Next
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _abort()
|
||||
}
|
||||
|
||||
|
||||
@Suppress("ClassName")
|
||||
@LowLevelApi
|
||||
public interface _Iterator<QueryUserExtension : Any, out Next> : _Scope<QueryUserExtension, Next> {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public fun _next(): Boolean
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.runtime
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
|
||||
public interface OutputRow<qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: qUE
|
||||
|
||||
public operator fun <RuntimeType> get(c: Column<RuntimeType, *, qUE>): RuntimeType
|
||||
|
||||
public operator fun get(c: Column<Byte, *, qUE>): Byte = this.get<Byte>(c)
|
||||
public operator fun get(c: Column<UByte, *, qUE>): UByte = this.get<UByte>(c)
|
||||
public operator fun get(c: Column<Short, *, qUE>): Short = this.get<Short>(c)
|
||||
public operator fun get(c: Column<UShort, *, qUE>): UShort = this.get<UShort>(c)
|
||||
public operator fun get(c: Column<Int, *, qUE>): Int = this.get<Int>(c)
|
||||
public operator fun get(c: Column<UInt, *, qUE>): UInt = this.get<UInt>(c)
|
||||
public operator fun get(c: Column<Long, *, qUE>): Long = this.get<Long>(c)
|
||||
public operator fun get(c: Column<ULong, *, qUE>): ULong = this.get<ULong>(c)
|
||||
public operator fun get(c: Column<Char, *, qUE>): Char = this.get<Char>(c)
|
||||
public operator fun get(c: Column<Boolean, *, qUE>): Boolean = this.get<Boolean>(c)
|
||||
|
||||
@Suppress("ClassName")
|
||||
@LowLevelApi
|
||||
public interface _Iterator<QueryUserExtension : Any, out Next> : OutputRow<QueryUserExtension> {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _next(): Boolean
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _abort()
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _finish(): Next
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.runtime
|
||||
|
||||
import ru.landgrafhomyak.db.serdha0.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.serdha0.api.queries._Query
|
||||
|
||||
public interface Transaction {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <QueryUserExtension : Any> _executeQuery(compiledQuery: _Query.Void2Table<QueryUserExtension>): OutputRow._Iterator<QueryUserExtension, Unit>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <QueryUserExtension : Any> _executeQuery(compiledQuery: _Query.Params2Table<QueryUserExtension>): InputRow._Scope<QueryUserExtension, OutputRow._Iterator<QueryUserExtension, Unit>>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <QueryUserExtension : Any> _executeQuery(compiledQuery: _Query.Table2Void<QueryUserExtension>): InputRow._Iterator<QueryUserExtension, Unit>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <QueryUserExtension : Any> _executeQuery(compiledQuery: _Query.Params2Void<QueryUserExtension>): InputRow._Scope<QueryUserExtension, Unit>
|
||||
|
||||
public suspend fun rollback()
|
||||
|
||||
public suspend fun commit()
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _assertTransactionFinishedAndReleaseResources()
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.RowExpression
|
||||
|
||||
public interface CheckConstraint<ttUE : Any> : RowExpression<ttUE, Boolean> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getName")
|
||||
public val name: String
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.RowExpression
|
||||
|
||||
public interface ColumnDefaultValue<ttUE : Any, R> : RowExpression<ttUE, R> {
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||
|
||||
public interface ForeignRowReference<ctUE : Any, ttUE : Any, RT, DT : DatabaseType<RT>> : Column<RT, DT, ctUE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("fromTable")
|
||||
public val fromTable: Table<ctUE, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("toTable")
|
||||
public val toTable: Table<ttUE, *>
|
||||
|
||||
|
||||
public enum class OnDelete {
|
||||
RESTRICT,
|
||||
|
||||
SET_NULL,
|
||||
|
||||
CASCADE
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
|
||||
public interface Index<OwnerTableUserExtension : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getName")
|
||||
public val name: String
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getTable")
|
||||
public val table: Table<OwnerTableUserExtension, *>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getColumns")
|
||||
public val columns: List<Column<*, *, OwnerTableUserExtension>>
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
|
||||
public interface RowId<@Suppress("unused") OwnerTableUserExtension: Any>
|
@ -0,0 +1,27 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc._Selectable
|
||||
import ru.landgrafhomyak.db.serdha0.api.module.Module
|
||||
|
||||
public interface Table<out UE : Any, pUE : Any> : _Selectable<UE> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public override val uExt: UE
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getName")
|
||||
public val name: String
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getModule")
|
||||
public val module: Module<*>
|
||||
|
||||
public enum class TemporaryType {
|
||||
TRANSACTION_SCOPE,
|
||||
CONNECTION_SCOPE,
|
||||
MODULE_UPGRADE_SCOPE
|
||||
}
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getTemporaryType")
|
||||
public val temporaryType: TemporaryType?
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.RowExpression
|
||||
|
||||
|
||||
public interface TableConstructor<tUE : Any> {
|
||||
public fun createTable(context: Scope<tUE>): tUE
|
||||
|
||||
|
||||
public interface Scope<tUE : Any> {
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("types")
|
||||
public val types: DatabaseType.Provider
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> column(name: String, type: DT): Column<RT, DT, tUE>
|
||||
|
||||
public fun index(name: String, vararg columns: Column<*, *, tUE>): Index<tUE>
|
||||
|
||||
public fun uniqueIndex(name: String, distinctNulls: Boolean, vararg columns: Column<*, *, tUE>): UniqueIndex<tUE>
|
||||
public fun checkConstraint(name: String, constructor: RowExpression.Constructor<tUE, *, Boolean>, recheckExistingRows: Boolean = false): CheckConstraint<tUE>
|
||||
public fun <RT : Any, DT : DatabaseType<RT>> defaultValue(c: Column<RT, DT, tUE>, value: RT): ColumnDefaultValue<tUE, RT>
|
||||
public fun <RT : Any, DT : DatabaseType<RT>> defaultValue(c: Column<RT, DT, tUE>, creator: RowExpression.Constructor<tUE, *, RT>): ColumnDefaultValue<tUE, RT>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rowIdColumn")
|
||||
public val rowIdColumn: Column<RowId<tUE>, DatabaseType.ROW_ID<tUE>, tUE>
|
||||
|
||||
public fun selfRowReference(
|
||||
columnName: String,
|
||||
onDelete: ForeignRowReference.OnDelete,
|
||||
): ForeignRowReference<tUE, tUE, RowId<tUE>, DatabaseType.ROW_ID<tUE>>
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> selfRowReference(
|
||||
columnName: String,
|
||||
type: DT,
|
||||
onDelete: ForeignRowReference.OnDelete,
|
||||
): ForeignRowReference<tUE, tUE, RT, DT>
|
||||
|
||||
public fun <ttUE : Any> foreignRowReference(
|
||||
columnName: String,
|
||||
toTable: Table<ttUE, *>,
|
||||
onDelete: ForeignRowReference.OnDelete,
|
||||
): ForeignRowReference<tUE, ttUE, RowId<ttUE>, DatabaseType.ROW_ID<ttUE>>
|
||||
|
||||
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> foreignRowReference(
|
||||
columnName: String,
|
||||
type: DT,
|
||||
toTable: Table<ttUE, *>,
|
||||
onDelete: ForeignRowReference.OnDelete,
|
||||
): ForeignRowReference<tUE, ttUE, RT, DT>
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.Column
|
||||
import ru.landgrafhomyak.db.serdha0.api.misc.DatabaseType
|
||||
|
||||
|
||||
public interface TableUpgrade<tnUE : Any, toUE : Any> {
|
||||
public fun upgradeTable(context: Scope<tnUE, toUE>): tnUE
|
||||
|
||||
public interface Scope<tnUE : Any, toUE : Any> : TableConstructor.Scope<tnUE> {
|
||||
public fun <RT, DT : DatabaseType<RT>> keepColumn(c: Column<RT, DT, toUE>): Column<RT, DT, tnUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> keepColumnUntilUpgraded(c: Column<RT, DT, toUE>): Column<RT, DT, tnUE>
|
||||
public fun <RT, DT : DatabaseType<RT>> renameAndKeepColumn(c: Column<RT, DT, toUE>, newName: String): Column<RT, DT, tnUE>
|
||||
public fun deleteColumn(c: Column<*, *, toUE>)
|
||||
|
||||
public fun keepIndex(i: Index<toUE>): Index<tnUE>
|
||||
public fun renameAndKeepIndex(i: Index<toUE>, newName: String): Index<tnUE>
|
||||
public fun deleteIndex(i: Index<toUE>)
|
||||
|
||||
public fun keepCheck(i: CheckConstraint<toUE>): CheckConstraint<tnUE>
|
||||
public fun renameAndKeepCheck(i: CheckConstraint<toUE>, newName: String): CheckConstraint<tnUE>
|
||||
public fun deleteCheck(i: CheckConstraint<toUE>)
|
||||
|
||||
public fun keepUniqueIndex(i: UniqueIndex<toUE>): UniqueIndex<tnUE>
|
||||
public fun renameAndKeepUniqueIndex(i: UniqueIndex<toUE>, newName: String): UniqueIndex<tnUE>
|
||||
public fun deleteUniqueIndex(i: UniqueIndex<toUE>)
|
||||
|
||||
public fun <RT, DT : DatabaseType<RT>> keepDefaultValue(c: Column<RT, DT, tnUE>, d: ColumnDefaultValue<toUE, RT>): ColumnDefaultValue<tnUE, RT>
|
||||
public fun <RT, DT : DatabaseType<RT>> changeDefaultValue(c: Column<RT, DT, tnUE>, d: ColumnDefaultValue<toUE, RT>): ColumnDefaultValue<tnUE, RT>
|
||||
public fun <RT, DT : DatabaseType<RT>> changeDefaultValue(c: Column<RT, DT, tnUE>, d: RT): ColumnDefaultValue<tnUE, RT>
|
||||
public fun deleteDefaultValue(i: ColumnDefaultValue<toUE, *>)
|
||||
|
||||
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> keepForeignRowReference(
|
||||
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
||||
onDelete: ForeignRowReference.OnDelete? = null
|
||||
): ForeignRowReference<toUE, ttUE, RT, DT>
|
||||
|
||||
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> keepForeignRowReferenceToUpdatedTable(
|
||||
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
||||
updatedType: nDT,
|
||||
updatedTable: Table<ttnUE, ttoUE>,
|
||||
onDelete: ForeignRowReference.OnDelete? = null
|
||||
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
||||
|
||||
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> renameAndKeepForeignRowReference(
|
||||
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
||||
onDelete: ForeignRowReference.OnDelete? = null
|
||||
): ForeignRowReference<tnUE, ttUE, RT, DT>
|
||||
|
||||
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> renameAndKeepForeignRowReferenceToUpdatedTable(
|
||||
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
||||
updatedType: nDT,
|
||||
updatedTable: Table<ttnUE, ttoUE>,
|
||||
onDelete: ForeignRowReference.OnDelete? = null
|
||||
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
||||
|
||||
public fun deleteForeignRowReference(frr: ForeignRowReference<toUE, *, *, *>)
|
||||
|
||||
public fun <ttUE : Any, RT, DT : DatabaseType<RT>> keepForeignRowReferenceUntilUpgraded(
|
||||
frr: ForeignRowReference<toUE, ttUE, RT, DT>,
|
||||
onDelete: ForeignRowReference.OnDelete? = null
|
||||
): ForeignRowReference<tnUE, ttUE, RT, DT>
|
||||
|
||||
public fun <ttoUE : Any, oRT, oDT : DatabaseType<oRT>, ttnUE : Any, nRT, nDT : DatabaseType<nRT>> keepForeignRowReferenceToUpdatedTableUntilUpgraded(
|
||||
frr: ForeignRowReference<toUE, ttoUE, oRT, oDT>,
|
||||
updatedType: nDT,
|
||||
updatedTable: Table<ttnUE, ttoUE>,
|
||||
onDelete: ForeignRowReference.OnDelete? = null
|
||||
): ForeignRowReference<tnUE, ttnUE, nRT, nDT>
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package ru.landgrafhomyak.db.serdha0.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
public interface UniqueIndex<OwnerTableUserExtension : Any> : Index<OwnerTableUserExtension> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("areNullsDistinct")
|
||||
public val areNullsDistinct: Boolean
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api
|
||||
|
||||
public enum class ApiVersion(public val str: String) {
|
||||
V_0_0("0.0") {
|
||||
override fun isImplements(v: ApiVersion): Boolean = this === v
|
||||
};
|
||||
|
||||
override fun toString(): String = "<db-skeleton api version '${this.str}'>"
|
||||
|
||||
public abstract fun isImplements(v: ApiVersion): Boolean
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api
|
||||
|
||||
public interface DatabaseType<@Suppress("unused") RUNTIME_TYPE : Any?> {
|
||||
public fun interface ImplementationsProvider<RUNTIME_TYPE> {
|
||||
public fun provideStatementImplementations_databaseType(scope: Scope<RUNTIME_TYPE>)
|
||||
|
||||
public interface Scope<RUNTIME_TYPE> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <DATABASE_TYPE, DATABASE_TYPE_UNBOUND> addImplementation(
|
||||
key: Driver<DATABASE_TYPE_UNBOUND, *, *, *, *, *, *, *, *, *>, type: DATABASE_TYPE
|
||||
) where DATABASE_TYPE_UNBOUND : DatabaseType<*>,
|
||||
DATABASE_TYPE : DatabaseType<RUNTIME_TYPE>,
|
||||
DATABASE_TYPE : DATABASE_TYPE_UNBOUND
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.RawStatement
|
||||
|
||||
public interface Driver<
|
||||
@Suppress("unused") DATABASE_TYPE : DatabaseType<*>,
|
||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__VOID_2_VOID : RawStatement.Void2Void.Constructor<*>,
|
||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__VOID_2_ROW : RawStatement.Void2Row.Constructor<*>,
|
||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__VOID_2_ROW_OR_NULL : RawStatement.Void2RowOrNull.Constructor<*>,
|
||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__VOID_2_TABLE : RawStatement.Void2Table.Constructor<*>,
|
||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__PARAMS_2_VOID : RawStatement.Params2Void.Constructor<*>,
|
||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__PARAMS_2_ROW : RawStatement.Params2Row.Constructor<*>,
|
||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__PARAMS_2_ROW_OR_NULL : RawStatement.Params2RowOrNull.Constructor<*>,
|
||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__PARAMS_2_TABLE : RawStatement.Params2Table.Constructor<*>,
|
||||
@Suppress("unused") OBJECT_OPERATIONS : ObjectClass<*>
|
||||
> {
|
||||
@ReflectionApi
|
||||
public fun isImplements(version: ApiVersion): Boolean
|
||||
|
||||
public fun assertImplemented_databaseType(ip: DatabaseType.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_rawStatement_void2void(ip: RawStatement.Void2Void.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_rawStatement_void2row(ip: RawStatement.Void2Row.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_rawStatement_void2rowOrNull(ip: RawStatement.Void2RowOrNull.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_rawStatement_void2table(ip: RawStatement.Void2Table.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_rawStatement_params2void(ip: RawStatement.Params2Void.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_rawStatement_params2row(ip: RawStatement.Params2Row.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_rawStatement_params2rowOrNull(ip: RawStatement.Params2RowOrNull.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_rawStatement_params2table(ip: RawStatement.Params2Table.ImplementationsProvider<*>)
|
||||
public fun assertImplemented_objectOperations(ip: ObjectClass.ImplementationsProvider)
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api
|
||||
|
||||
public enum class LifeTime {
|
||||
REGULAR {
|
||||
override fun isAlwaysAvailableAt(parent: LifeTime): Boolean = true
|
||||
},
|
||||
|
||||
TRANSACTION_SCOPE {
|
||||
override fun isAlwaysAvailableAt(scope: LifeTime): Boolean = scope === this
|
||||
},
|
||||
|
||||
CONNECTION_SCOPE {
|
||||
override fun isAlwaysAvailableAt(scope: LifeTime): Boolean = scope === LifeTime.TRANSACTION_SCOPE || scope === this
|
||||
},
|
||||
|
||||
MODULE_UPGRADE_SCOPE {
|
||||
override fun isAlwaysAvailableAt(scope: LifeTime): Boolean = scope === this
|
||||
};
|
||||
|
||||
public abstract fun isAlwaysAvailableAt(scope: LifeTime): Boolean
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api
|
||||
|
||||
public interface ObjectClass<@Suppress("unused") UE : Any?> {
|
||||
public fun interface ImplementationsProvider {
|
||||
public fun provideStatementImplementations_databaseType(scope: Scope)
|
||||
|
||||
public interface Scope {
|
||||
public fun <CLASS : ObjectClass<*>> addImplementation(
|
||||
key: Driver<*, *, *, *, *, *, *, *, *, CLASS>, type: CLASS
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api
|
||||
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@RequiresOptIn
|
||||
public annotation class ReflectionApi
|
@ -1,4 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
public annotation class SinceApi(val version: ApiVersion)
|
@ -1,20 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors
|
||||
|
||||
import kotlin.jvm.JvmStatic
|
||||
import kotlinx.coroutines.CopyableThrowable
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.InputParam
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
|
||||
|
||||
@ReflectionApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
public class AccessWhileInitializationException : IllegalStateException, CopyableThrowable<AccessWhileInitializationException> {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
|
||||
override fun createCopy(): AccessWhileInitializationException? =
|
||||
AccessWhileInitializationException(this.message, this.cause)
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors
|
||||
|
||||
import kotlin.jvm.JvmStatic
|
||||
import kotlinx.coroutines.CopyableThrowable
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
|
||||
@ReflectionApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
public class EntityOutdatedException : IllegalArgumentException, CopyableThrowable<EntityOutdatedException> {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
|
||||
override fun createCopy(): EntityOutdatedException? = EntityOutdatedException(this.message, this.cause)
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
|
||||
|
||||
@ReflectionApi
|
||||
public abstract class ExecutionException : RuntimeException {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors
|
||||
|
||||
import kotlinx.coroutines.CopyableThrowable
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@ReflectionApi
|
||||
public open class InternalDriverException : RuntimeException, CopyableThrowable<InternalDriverException> {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
|
||||
|
||||
override fun createCopy(): InternalDriverException? {
|
||||
if (this::class !== InternalDriverException::class)
|
||||
return null
|
||||
|
||||
return InternalDriverException(this.message, this.cause)
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors
|
||||
|
||||
import kotlinx.coroutines.CopyableThrowable
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@ReflectionApi
|
||||
public open class SchemaDefinitionException : RuntimeException, CopyableThrowable<SchemaDefinitionException> {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
|
||||
override fun createCopy(): SchemaDefinitionException? {
|
||||
if (this::class !== SchemaDefinitionException::class)
|
||||
return null
|
||||
|
||||
return SchemaDefinitionException(this.message, this.cause)
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
|
||||
@ReflectionApi
|
||||
public abstract class SchemaSynchronizationException : RuntimeException {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors
|
||||
|
||||
import kotlin.jvm.JvmStatic
|
||||
import kotlinx.coroutines.CopyableThrowable
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.InputParam
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
|
||||
|
||||
@ReflectionApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
public class ScopeAlreadyFinishedException : IllegalStateException, CopyableThrowable<ScopeAlreadyFinishedException> {
|
||||
public val scope: Any
|
||||
public val member: Any
|
||||
|
||||
public constructor(scope: Any, member: Any) : super() {
|
||||
this.scope = scope
|
||||
this.member = member
|
||||
}
|
||||
|
||||
public constructor(scope: Any, member: Any, customMessage: String) : super(customMessage) {
|
||||
this.scope = scope
|
||||
this.member = member
|
||||
}
|
||||
|
||||
public constructor(scope: Any, member: Any, customMessage: String, cause: Throwable) : super(customMessage, cause) {
|
||||
this.scope = scope
|
||||
this.member = member
|
||||
}
|
||||
|
||||
public constructor(scope: Any, member: Any, cause: Throwable) : super(cause) {
|
||||
this.scope = scope
|
||||
this.member = member
|
||||
}
|
||||
|
||||
public constructor(
|
||||
scope: Any, member: Any,
|
||||
message: String?,
|
||||
cause: Throwable?,
|
||||
@Suppress("unused", "LocalVariableName") _marker: Unit
|
||||
) : super(message, cause) {
|
||||
this.scope = scope
|
||||
this.member = member
|
||||
}
|
||||
|
||||
|
||||
override fun createCopy(): ScopeAlreadyFinishedException? {
|
||||
return ScopeAlreadyFinishedException(
|
||||
scope = this.scope,
|
||||
member = this.member,
|
||||
message = this.message,
|
||||
cause = this.cause,
|
||||
_marker = Unit
|
||||
)
|
||||
}
|
||||
|
||||
public companion object {
|
||||
@JvmStatic
|
||||
public fun formatMessage(scope: Any, member: Any): String =
|
||||
"Attempt to access $member of $scope after it was closed"
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors
|
||||
|
||||
import kotlin.jvm.JvmStatic
|
||||
import kotlinx.coroutines.CopyableThrowable
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.InputParam
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
|
||||
|
||||
@ReflectionApi
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
public class UninitializedParameterException : RuntimeException, CopyableThrowable<UninitializedParameterException> {
|
||||
public val statement: _Statement<*>
|
||||
public val params: Collection<InputParam<*, *>>
|
||||
|
||||
public constructor(statement: _Statement<*>, params: Collection<InputParam<*, *>>) : super(formatMessage(statement, params)) {
|
||||
this.statement = statement
|
||||
this.params = params
|
||||
}
|
||||
|
||||
public constructor(statement: _Statement<*>, params: Collection<InputParam<*, *>>, message: String) : super(message) {
|
||||
this.statement = statement
|
||||
this.params = params
|
||||
}
|
||||
|
||||
public constructor(statement: _Statement<*>, params: Collection<InputParam<*, *>>, message: String, cause: Throwable) : super(message, cause) {
|
||||
this.statement = statement
|
||||
this.params = params
|
||||
}
|
||||
|
||||
public constructor(statement: _Statement<*>, params: Collection<InputParam<*, *>>, cause: Throwable) : super(formatMessage(statement, params), cause) {
|
||||
this.statement = statement
|
||||
this.params = params
|
||||
}
|
||||
|
||||
public constructor(
|
||||
statement: _Statement<*>,
|
||||
params: Collection<InputParam<*, *>>,
|
||||
message: String?,
|
||||
cause: Throwable?,
|
||||
@Suppress("unused", "LocalVariableName") _marker: Unit
|
||||
) : super(message, cause) {
|
||||
this.statement = statement
|
||||
this.params = params
|
||||
}
|
||||
|
||||
|
||||
override fun createCopy(): UninitializedParameterException? {
|
||||
return UninitializedParameterException(
|
||||
statement = this.statement,
|
||||
params = this.params,
|
||||
message = this.message,
|
||||
cause = this.cause,
|
||||
_marker = Unit
|
||||
)
|
||||
}
|
||||
|
||||
public companion object {
|
||||
@JvmStatic
|
||||
public fun formatMessage(statement: _Statement<*>, params: Collection<InputParam<*, *>>): String =
|
||||
"While preparing statement $statement following parameters wasn't initialized: ${params.joinToString()}"
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors.synchronization
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaSynchronizationException
|
||||
|
||||
@ReflectionApi
|
||||
public abstract class SchemaExecutionException : SchemaSynchronizationException {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.errors.synchronization
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.errors.SchemaSynchronizationException
|
||||
|
||||
@ReflectionApi
|
||||
public abstract class SchemaMismatchException : SchemaSynchronizationException {
|
||||
public constructor() : super()
|
||||
public constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.module
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LifeTime
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.QueriesCompiler
|
||||
import ru.landgrafhomyak.db.skeleton1.api.runtime.Transaction
|
||||
import ru.landgrafhomyak.db.skeleton1.api.table.Table
|
||||
|
||||
|
||||
public interface Module<UE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: UE
|
||||
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getVersionKey")
|
||||
public val versionKey: String
|
||||
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getParentModule")
|
||||
public val parentModule: Module<*>?
|
||||
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getPathFromParentModuleRoot")
|
||||
public val pathFromParentModuleRoot: List<String>?
|
||||
|
||||
@ReflectionApi
|
||||
public val lifeTime: LifeTime
|
||||
|
||||
@ReflectionApi
|
||||
public fun memberTables(lifeTime: LifeTime): Collection<Table<*, UE>>
|
||||
|
||||
@ReflectionApi
|
||||
public fun memberObjects(lifeTime: LifeTime): Collection<ModuleScopedObject<UE>>
|
||||
|
||||
@ReflectionApi
|
||||
public fun memberSubmodules(lifeTime: LifeTime): Collection<Table<*, UE>>
|
||||
|
||||
public val unwrappedModule: Module<UE>
|
||||
|
||||
public interface Constructor<mUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("versionKey")
|
||||
public val versionKey: String
|
||||
|
||||
public fun createSchema(context: ModuleConstructorScope<mUE>): mUE
|
||||
|
||||
public suspend fun initData(ext: mUE, compiler: QueriesCompiler, transaction: Transaction) {}
|
||||
}
|
||||
|
||||
public interface Upgrade<nmUE : Any, omUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("versionKey")
|
||||
public val versionKey: String
|
||||
|
||||
public fun upgradeSchema(context: ModuleUpgradeScope<nmUE, omUE>): nmUE
|
||||
|
||||
public suspend fun upgradeData(ext: nmUE, compiler: QueriesCompiler, transaction: Transaction) {}
|
||||
}
|
||||
|
||||
public interface Template<@Suppress("unused") mUE : Any> {
|
||||
@LowLevelApi
|
||||
public fun getConstructor(): Constructor<Any>
|
||||
|
||||
@LowLevelApi
|
||||
public fun getUpgrade(version: String): Upgrade<Any, Any>?
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.module
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LifeTime
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ObjectClass
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.RawStatement
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
|
||||
import ru.landgrafhomyak.db.skeleton1.api.table.Table
|
||||
import ru.landgrafhomyak.db.skeleton1.api.runtime.InputRow
|
||||
|
||||
|
||||
public interface ModuleConstructorScope<UE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("rootNs")
|
||||
public val rootNameNode: NameNode<UE>
|
||||
|
||||
public fun <tUE : Any> table_create(
|
||||
lifeTime: LifeTime = LifeTime.REGULAR,
|
||||
location: NameNode<UE>,
|
||||
initializer: Table.Constructor<tUE>
|
||||
): Table<tUE, UE>
|
||||
|
||||
public fun object_create(
|
||||
lifeTime: LifeTime = LifeTime.REGULAR,
|
||||
location: NameNode<UE>,
|
||||
metadata: ObjectClass.ImplementationsProvider
|
||||
): ModuleScopedObject<UE>
|
||||
|
||||
public fun <smUE : Any> submodule_substitute(location: NameNode<UE>, template: Module.Template<smUE>): Module<smUE>
|
||||
|
||||
public fun nameNode(parent: NameNode<UE>, name: String): NameNode<UE>
|
||||
|
||||
public fun addStatement(statement: _Statement.Void2Void<*>)
|
||||
public fun addStatement(provider: RawStatement.Void2Void.ImplementationsProvider<*>)
|
||||
|
||||
@LowLevelApi
|
||||
public fun <sUE : Any> _addStatement(statement: _Statement.Params2Void<sUE>): InputRow._Scope<sUE, Unit>
|
||||
|
||||
@LowLevelApi
|
||||
public fun <sUE : Any> _addStatement(provider: RawStatement.Params2Void.ImplementationsProvider<sUE>): InputRow._Scope<sUE, Unit>
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.module
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LifeTime
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ObjectClass
|
||||
|
||||
public interface ModuleScopedObject<pmUE : Any> {
|
||||
@ReflectionApi
|
||||
public val parentModule: Module<pmUE>
|
||||
|
||||
@ReflectionApi
|
||||
public val pathFromParentModuleRoot: List<String>
|
||||
|
||||
@ReflectionApi
|
||||
public val objectClassProvider: ObjectClass.ImplementationsProvider
|
||||
|
||||
public val unwrappedModuleScopedObject: ModuleScopedObject<pmUE>
|
||||
|
||||
@ReflectionApi
|
||||
public val lifeTime: LifeTime
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.module
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.RawStatement
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
|
||||
import ru.landgrafhomyak.db.skeleton1.api.runtime.InputRow
|
||||
import ru.landgrafhomyak.db.skeleton1.api.table.Table
|
||||
|
||||
|
||||
public interface ModuleUpgradeScope<nUE : Any, oUE : Any> : ModuleConstructorScope<nUE> {
|
||||
// Table -------------------------------------------------------------------
|
||||
public fun <tUE : Any> table_keep(table: Table<tUE, oUE>): Table<tUE, nUE>
|
||||
public fun <tUE : Any> table_keepAndMove(table: Table<tUE, oUE>, newLocation: NameNode<nUE>): Table<tUE, nUE>
|
||||
|
||||
public fun <tnUE : Any, toUE : Any> table_upgrade(table: Table<toUE, oUE>, upgrade: Table.Upgrade<tnUE, toUE>): Table<tnUE, nUE>
|
||||
public fun <tnUE : Any, toUE : Any> table_upgradeAndMove(table: Table<toUE, oUE>, newLocation: NameNode<nUE>, upgrade: Table.Upgrade<tnUE, toUE>): Table<tnUE, nUE>
|
||||
|
||||
public fun table_delete(table: Table<*, oUE>)
|
||||
public fun <tUE : Any> table_deleteAfterModuleUpgrade(table: Table<tUE, oUE>): Table<tUE, nUE>
|
||||
|
||||
public fun table_export(table: Table<*, oUE>)
|
||||
|
||||
public fun <tUE : Any> table_import(table: Table<tUE, *>, location: NameNode<nUE>): Table<tUE, nUE>
|
||||
public fun <tnUE : Any, toUE : Any> table_importAndUpgrade(table: Table<toUE, *>, location: NameNode<nUE>, upgrade: Table.Upgrade<tnUE, toUE>): Table<tnUE, nUE>
|
||||
|
||||
// Object ------------------------------------------------------------------
|
||||
|
||||
public fun object_keep(obj: ModuleScopedObject<oUE>): ModuleScopedObject<nUE>
|
||||
public fun object_keepAndMove(obj: ModuleScopedObject<oUE>, newLocation: NameNode<nUE>): ModuleScopedObject<nUE>
|
||||
|
||||
public fun object_delete(obj: ModuleScopedObject<oUE>)
|
||||
public fun object_deleteAfterModuleUpgrade(obj: ModuleScopedObject<oUE>): ModuleScopedObject<nUE>
|
||||
|
||||
public fun object_export(obj: ModuleScopedObject<oUE>)
|
||||
public fun object_import(obj: ModuleScopedObject<*>, location: NameNode<nUE>): ModuleScopedObject<nUE>
|
||||
|
||||
// Module ------------------------------------------------------------------
|
||||
|
||||
public fun <smUE : Any> submodule_keep(submodule: Module<smUE>): Module<smUE>
|
||||
public fun <smUE : Any> submodule_keepAndMove(submodule: Module<smUE>, newLocation: NameNode<nUE>): Module<smUE>
|
||||
|
||||
public fun <smUE : Any> submodule_upgrade(submodule: Module<*>, template: Module.Template<smUE>): Module<smUE>
|
||||
public fun <smUE : Any> submodule_upgradeAndMove(submodule: Module<*>, newLocation: NameNode<nUE>, template: Module.Template<smUE>): Module<smUE>
|
||||
|
||||
public fun submodule_delete(submodule: Module<*>)
|
||||
public fun <smUE : Any> submodule_deleteAfterModuleUpgrade(submodule: Module<smUE>): Module<smUE>
|
||||
|
||||
public fun submodule_export(submodule: Module<*>)
|
||||
|
||||
public fun <smUE : Any> submodule_import(module: Module<smUE>, location: NameNode<nUE>): Module<smUE>
|
||||
|
||||
public fun <smUE : Any> submodule_importAndUpgrade(module: Module<smUE>, location: NameNode<nUE>, template: Module.Template<smUE>): Module<smUE>
|
||||
|
||||
// Statements --------------------------------------------------------------
|
||||
|
||||
public fun addStatementAfterUpgrade(statement: _Statement.Void2Void<*>)
|
||||
public fun addStatementAfterUpgrade(provider: RawStatement.Void2Void.ImplementationsProvider<*>)
|
||||
|
||||
@LowLevelApi
|
||||
public fun <sUE : Any> _addStatementAfterUpgrade(statement: _Statement.Params2Void<sUE>): InputRow._Scope<sUE, Unit>
|
||||
|
||||
@LowLevelApi
|
||||
public fun <sUE : Any> _addStatementAfterUpgrade(provider: RawStatement.Params2Void.ImplementationsProvider<sUE>): InputRow._Scope<sUE, Unit>
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.module
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
|
||||
public interface NameNode<pmUE : Any> {
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getName")
|
||||
public val name: String
|
||||
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getPath")
|
||||
public val parent: NameNode<pmUE>?
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.runtime
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
|
||||
public interface Executor {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _startTransaction(): Transaction
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.runtime
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.InputParam
|
||||
|
||||
public interface InputRow<qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: qUE
|
||||
|
||||
public operator fun <RuntimeType> set(c: InputParam<RuntimeType, qUE>, value: RuntimeType)
|
||||
|
||||
public operator fun set(c: InputParam<Byte, qUE>, value: Byte): Unit = this.set<Byte>(c, value)
|
||||
public operator fun set(c: InputParam<UByte, qUE>, value: UByte): Unit = this.set<UByte>(c, value)
|
||||
public operator fun set(c: InputParam<Short, qUE>, value: Short): Unit = this.set<Short>(c, value)
|
||||
public operator fun set(c: InputParam<UShort, qUE>, value: UShort): Unit = this.set<UShort>(c, value)
|
||||
public operator fun set(c: InputParam<Int, qUE>, value: Int): Unit = this.set<Int>(c, value)
|
||||
public operator fun set(c: InputParam<UInt, qUE>, value: UInt): Unit = this.set<UInt>(c, value)
|
||||
public operator fun set(c: InputParam<Long, qUE>, value: Long): Unit = this.set<Long>(c, value)
|
||||
public operator fun set(c: InputParam<ULong, qUE>, value: ULong): Unit = this.set<ULong>(c, value)
|
||||
public operator fun set(c: InputParam<Char, qUE>, value: Char): Unit = this.set<Char>(c, value)
|
||||
public operator fun set(c: InputParam<Boolean, qUE>, value: Boolean): Unit = this.set<Boolean>(c, value)
|
||||
|
||||
@Suppress("ClassName")
|
||||
@LowLevelApi
|
||||
public interface _Scope<qUE : Any, out Next> : InputRow<qUE> {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _finish(): Next
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _abort()
|
||||
}
|
||||
|
||||
@Suppress("ClassName")
|
||||
@LowLevelApi
|
||||
public interface _Iterator<qUE : Any, out Next> : _Scope<qUE, Next>, InputRow<qUE> {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _next(): Boolean
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public override suspend fun _abort()
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public override suspend fun _finish(): Next
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.runtime
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.OutputColumn
|
||||
|
||||
public interface OutputRow<qUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: qUE
|
||||
|
||||
public operator fun <RuntimeType> get(c: OutputColumn<RuntimeType, qUE>): RuntimeType
|
||||
|
||||
public operator fun get(c: OutputColumn<Byte, qUE>): Byte = this.get<Byte>(c)
|
||||
public operator fun get(c: OutputColumn<UByte, qUE>): UByte = this.get<UByte>(c)
|
||||
public operator fun get(c: OutputColumn<Short, qUE>): Short = this.get<Short>(c)
|
||||
public operator fun get(c: OutputColumn<UShort, qUE>): UShort = this.get<UShort>(c)
|
||||
public operator fun get(c: OutputColumn<Int, qUE>): Int = this.get<Int>(c)
|
||||
public operator fun get(c: OutputColumn<UInt, qUE>): UInt = this.get<UInt>(c)
|
||||
public operator fun get(c: OutputColumn<Long, qUE>): Long = this.get<Long>(c)
|
||||
public operator fun get(c: OutputColumn<ULong, qUE>): ULong = this.get<ULong>(c)
|
||||
public operator fun get(c: OutputColumn<Char, qUE>): Char = this.get<Char>(c)
|
||||
public operator fun get(c: OutputColumn<Boolean, qUE>): Boolean = this.get<Boolean>(c)
|
||||
|
||||
@Suppress("ClassName")
|
||||
@LowLevelApi
|
||||
public interface _Scope<qUE : Any,out Next> : OutputRow<qUE> {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _finish(): Next
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _abort()
|
||||
}
|
||||
|
||||
@Suppress("ClassName")
|
||||
@LowLevelApi
|
||||
public interface _Iterator<qUE : Any, out Next> : _Scope<qUE, Next>, OutputRow<qUE> {
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _next(): Boolean
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public override suspend fun _abort()
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public override suspend fun _finish(): Next
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.runtime
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
|
||||
|
||||
public interface Transaction {
|
||||
public suspend fun <qUE : Any?> executeQuery_void2void(compiledQuery: _Statement.Void2Void<qUE>)
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <qUE : Any> _executeQuery_void2row(compiledQuery: _Statement.Void2Row<qUE>): OutputRow._Scope<qUE, Unit>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <qUE : Any> _executeQuery_void2rowOrNull(compiledQuery: _Statement.Void2RowOrNull<qUE>): OutputRow._Scope<qUE, Unit>?
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <qUE : Any> _executeQuery_void2table(compiledQuery: _Statement.Void2RowOrNull<qUE>): OutputRow._Iterator<qUE, Unit>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <qUE : Any> _executeQuery_params2void(compiledQuery: _Statement.Void2Void<qUE>): InputRow._Scope<qUE, Unit>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <qUE : Any> _executeQuery_params2row(compiledQuery: _Statement.Void2Row<qUE>): InputRow._Scope<qUE, OutputRow._Scope<qUE, Unit>>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <qUE : Any> _executeQuery_params2rowOrNull(compiledQuery: _Statement.Void2RowOrNull<qUE>): InputRow._Scope<qUE, OutputRow._Scope<qUE, Unit>?>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <qUE : Any> _executeQuery_params2table(compiledQuery: _Statement.Void2RowOrNull<qUE>): InputRow._Scope<qUE, OutputRow._Iterator<qUE, Unit>>
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun <qUE : Any> _executeBatch_params2void(compiledQuery: _Statement.Void2Void<qUE>): InputRow._Iterator<qUE, Unit>
|
||||
|
||||
public suspend fun rollback()
|
||||
|
||||
public suspend fun commit()
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@LowLevelApi
|
||||
public suspend fun _assertTransactionFinishedAndReleaseResources()
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.statement
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
|
||||
public interface InputParam<@Suppress("unused") RT, sUE : Any> {
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getName")
|
||||
public val name: String
|
||||
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getStatement")
|
||||
public val statement: _Statement<sUE>
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.statement
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
|
||||
public interface OutputColumn<@Suppress("unused") RT, sUE : Any> {
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("name")
|
||||
public val name: String
|
||||
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getStatement")
|
||||
public val statement: _Statement<sUE>
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.statement
|
||||
|
||||
public interface QueriesCompiler {
|
||||
public fun <sUE : Any?> raw_void2void(constructor: RawStatement.Void2Void.ImplementationsProvider<sUE>): RawStatement.Void2Void<sUE>
|
||||
public fun <sUE : Any> raw_void2row(constructor: RawStatement.Void2Row.ImplementationsProvider<sUE>): RawStatement.Void2Row<sUE>
|
||||
public fun <sUE : Any> raw_void2rowOrNull(constructor: RawStatement.Void2RowOrNull.ImplementationsProvider<sUE>): RawStatement.Void2RowOrNull<sUE>
|
||||
public fun <sUE : Any> raw_void2table(constructor: RawStatement.Void2Table.ImplementationsProvider<sUE>): RawStatement.Void2Table<sUE>
|
||||
public fun <sUE : Any> raw_params2void(constructor: RawStatement.Params2Void.ImplementationsProvider<sUE>): RawStatement.Params2Void<sUE>
|
||||
public fun <sUE : Any> raw_params2row(constructor: RawStatement.Params2Row.ImplementationsProvider<sUE>): RawStatement.Params2Row<sUE>
|
||||
public fun <sUE : Any> raw_params2rowOrNull(constructor: RawStatement.Params2RowOrNull.ImplementationsProvider<sUE>): RawStatement.Params2RowOrNull<sUE>
|
||||
public fun <sUE : Any> raw_params2table(constructor: RawStatement.Params2Table.ImplementationsProvider<sUE>): RawStatement.Params2Table<sUE>
|
||||
}
|
@ -1,182 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.statement
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.Driver
|
||||
|
||||
public interface RawStatement<sUE : Any?> : _Statement<sUE> {
|
||||
public override val uExt: sUE
|
||||
|
||||
public interface Void2Void<sUE : Any?> : RawStatement<sUE>, _Statement.Void2Void<sUE> {
|
||||
override val uExt: sUE
|
||||
|
||||
public interface Constructor<@Suppress("unused") sUE : Any?>
|
||||
|
||||
public interface ImplementationsProvider<USER_EXTENSION : Any?> {
|
||||
public fun provideStatementImplementations_void2void(scope: Scope<USER_EXTENSION>)
|
||||
|
||||
public interface Scope<USER_EXTENSION : Any?> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <STATEMENT_CONSTRUCTOR, STATEMENT_CONSTRUCTOR_UNBOUND> addImplementation(
|
||||
driver: Driver<*, STATEMENT_CONSTRUCTOR_UNBOUND, *, *, *, *, *, *, *, *>,
|
||||
constructor: STATEMENT_CONSTRUCTOR
|
||||
) where STATEMENT_CONSTRUCTOR_UNBOUND : Constructor<*>,
|
||||
STATEMENT_CONSTRUCTOR : Constructor<USER_EXTENSION>,
|
||||
STATEMENT_CONSTRUCTOR : STATEMENT_CONSTRUCTOR_UNBOUND
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Void2Row<sUE : Any> : RawStatement<sUE>, _Statement.Void2Row<sUE> {
|
||||
override val uExt: sUE
|
||||
|
||||
public interface Constructor<sUE : Any> {
|
||||
public fun declareIO(scope: StatementIODeclarationScope.Output<sUE>): sUE
|
||||
}
|
||||
|
||||
public interface ImplementationsProvider<USER_EXTENSION : Any> {
|
||||
public fun provideStatementImplementations_void2row(scope: Scope<USER_EXTENSION>)
|
||||
|
||||
public interface Scope<USER_EXTENSION : Any> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <STATEMENT_CONSTRUCTOR, STATEMENT_CONSTRUCTOR_UNBOUND> addImplementation(
|
||||
driver: Driver<*, *, STATEMENT_CONSTRUCTOR_UNBOUND, *, *, *, *, *, *, *>,
|
||||
constructor: STATEMENT_CONSTRUCTOR
|
||||
) where STATEMENT_CONSTRUCTOR_UNBOUND : Constructor<*>,
|
||||
STATEMENT_CONSTRUCTOR : Constructor<USER_EXTENSION>,
|
||||
STATEMENT_CONSTRUCTOR : STATEMENT_CONSTRUCTOR_UNBOUND
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Void2RowOrNull<sUE : Any> : RawStatement<sUE>, _Statement.Void2RowOrNull<sUE> {
|
||||
override val uExt: sUE
|
||||
|
||||
public interface Constructor<sUE : Any> {
|
||||
public fun declareIO(scope: StatementIODeclarationScope.Output<sUE>): sUE
|
||||
}
|
||||
|
||||
public interface ImplementationsProvider<USER_EXTENSION : Any> {
|
||||
public fun provideStatementImplementations_void2rowOrNull(scope: Scope<USER_EXTENSION>)
|
||||
|
||||
public interface Scope<USER_EXTENSION : Any> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <STATEMENT_CONSTRUCTOR, STATEMENT_CONSTRUCTOR_UNBOUND> addImplementation(
|
||||
driver: Driver<*, *, *, STATEMENT_CONSTRUCTOR_UNBOUND, *, *, *, *, *, *>,
|
||||
constructor: STATEMENT_CONSTRUCTOR
|
||||
) where STATEMENT_CONSTRUCTOR_UNBOUND : Constructor<*>,
|
||||
STATEMENT_CONSTRUCTOR : Constructor<USER_EXTENSION>,
|
||||
STATEMENT_CONSTRUCTOR : STATEMENT_CONSTRUCTOR_UNBOUND
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface Void2Table<sUE : Any> : RawStatement<sUE>, _Statement.Void2Table<sUE> {
|
||||
override val uExt: sUE
|
||||
|
||||
public interface Constructor<sUE : Any> {
|
||||
public fun declareIO(scope: StatementIODeclarationScope.Output<sUE>): sUE
|
||||
}
|
||||
|
||||
public interface ImplementationsProvider<USER_EXTENSION : Any> {
|
||||
public fun provideStatementImplementations_void2table(selector: Selector<USER_EXTENSION>)
|
||||
|
||||
public interface Selector<USER_EXTENSION : Any> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <STATEMENT_CONSTRUCTOR, STATEMENT_CONSTRUCTOR_UNBOUND> addImplementation(
|
||||
driver: Driver<*, *, *, *, STATEMENT_CONSTRUCTOR_UNBOUND, *, *, *, *, *>,
|
||||
constructor: STATEMENT_CONSTRUCTOR
|
||||
) where STATEMENT_CONSTRUCTOR_UNBOUND : Constructor<*>,
|
||||
STATEMENT_CONSTRUCTOR : Constructor<USER_EXTENSION>,
|
||||
STATEMENT_CONSTRUCTOR : STATEMENT_CONSTRUCTOR_UNBOUND
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Params2Void<sUE : Any> : RawStatement<sUE>, _Statement.Params2Void<sUE> {
|
||||
override val uExt: sUE
|
||||
|
||||
public interface Constructor<sUE : Any> {
|
||||
public fun declareIO(scope: StatementIODeclarationScope.Input<sUE>): sUE
|
||||
}
|
||||
|
||||
public interface ImplementationsProvider<USER_EXTENSION : Any> {
|
||||
public fun provideStatementImplementations_params2void(scope: Scope<USER_EXTENSION>)
|
||||
|
||||
public interface Scope<USER_EXTENSION : Any> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <STATEMENT_CONSTRUCTOR, STATEMENT_CONSTRUCTOR_UNBOUND> addImplementation(
|
||||
driver: Driver<*, *, *, *, *, STATEMENT_CONSTRUCTOR_UNBOUND, *, *, *, *>,
|
||||
constructor: STATEMENT_CONSTRUCTOR
|
||||
) where STATEMENT_CONSTRUCTOR_UNBOUND : Constructor<*>,
|
||||
STATEMENT_CONSTRUCTOR : Constructor<USER_EXTENSION>,
|
||||
STATEMENT_CONSTRUCTOR : STATEMENT_CONSTRUCTOR_UNBOUND
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Params2Row<sUE : Any> : RawStatement<sUE>, _Statement.Params2Row<sUE> {
|
||||
override val uExt: sUE
|
||||
|
||||
public interface Constructor<sUE : Any> {
|
||||
public fun declareIO(scope: StatementIODeclarationScope.InputOutput<sUE>): sUE
|
||||
}
|
||||
|
||||
public interface ImplementationsProvider<USER_EXTENSION : Any> {
|
||||
public fun provideStatementImplementations_params2row(scope: Scope<USER_EXTENSION>)
|
||||
|
||||
public interface Scope<USER_EXTENSION : Any> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <STATEMENT_CONSTRUCTOR, STATEMENT_CONSTRUCTOR_UNBOUND> addImplementation(
|
||||
driver: Driver<*, *, *, *, *, *, STATEMENT_CONSTRUCTOR_UNBOUND, *, *, *>,
|
||||
constructor: STATEMENT_CONSTRUCTOR
|
||||
) where STATEMENT_CONSTRUCTOR_UNBOUND : Constructor<*>,
|
||||
STATEMENT_CONSTRUCTOR : Constructor<USER_EXTENSION>,
|
||||
STATEMENT_CONSTRUCTOR : STATEMENT_CONSTRUCTOR_UNBOUND
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Params2RowOrNull<sUE : Any> : RawStatement<sUE>, _Statement.Params2RowOrNull<sUE> {
|
||||
override val uExt: sUE
|
||||
|
||||
public interface Constructor<sUE : Any> {
|
||||
public fun declareIO(scope: StatementIODeclarationScope.InputOutput<sUE>): sUE
|
||||
}
|
||||
|
||||
public interface ImplementationsProvider<USER_EXTENSION : Any> {
|
||||
public fun provideStatementImplementations_params2rowOrNull(scope: Scope<USER_EXTENSION>)
|
||||
|
||||
public interface Scope<USER_EXTENSION : Any> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <STATEMENT_CONSTRUCTOR, STATEMENT_CONSTRUCTOR_UNBOUND> addImplementation(
|
||||
driver: Driver<*, *, *, *, *, *, *, STATEMENT_CONSTRUCTOR_UNBOUND, *, *>,
|
||||
constructor: STATEMENT_CONSTRUCTOR
|
||||
) where STATEMENT_CONSTRUCTOR_UNBOUND : Constructor<*>,
|
||||
STATEMENT_CONSTRUCTOR : Constructor<USER_EXTENSION>,
|
||||
STATEMENT_CONSTRUCTOR : STATEMENT_CONSTRUCTOR_UNBOUND
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Params2Table<sUE : Any> : RawStatement<sUE>, _Statement.Params2Table<sUE> {
|
||||
override val uExt: sUE
|
||||
|
||||
public interface Constructor<sUE : Any> {
|
||||
public fun declareIO(scope: StatementIODeclarationScope.InputOutput<sUE>): sUE
|
||||
}
|
||||
|
||||
public interface ImplementationsProvider<USER_EXTENSION : Any> {
|
||||
public fun provideStatementImplementations_params2table(scope: Scope<USER_EXTENSION>)
|
||||
|
||||
public interface Scope<USER_EXTENSION : Any> {
|
||||
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
|
||||
public fun <STATEMENT_CONSTRUCTOR, STATEMENT_CONSTRUCTOR_UNBOUND> addImplementation(
|
||||
driver: Driver<*, *, *, *, *, *, *, *, STATEMENT_CONSTRUCTOR_UNBOUND, *>,
|
||||
constructor: STATEMENT_CONSTRUCTOR
|
||||
) where STATEMENT_CONSTRUCTOR_UNBOUND : Constructor<*>,
|
||||
STATEMENT_CONSTRUCTOR : Constructor<USER_EXTENSION>,
|
||||
STATEMENT_CONSTRUCTOR : STATEMENT_CONSTRUCTOR_UNBOUND
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.statement
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.DatabaseType
|
||||
|
||||
public interface StatementIODeclarationScope<@Suppress("unused") sUE : Any> {
|
||||
public interface Input<sUE : Any> : StatementIODeclarationScope<sUE> {
|
||||
public fun <RT> inputParam(type: DatabaseType.ImplementationsProvider<RT>): InputParam<RT, sUE>
|
||||
}
|
||||
|
||||
public interface Output<sUE : Any> : StatementIODeclarationScope<sUE> {
|
||||
public fun <RT> outputColumn(type: DatabaseType.ImplementationsProvider<RT>): OutputColumn<RT, sUE>
|
||||
}
|
||||
|
||||
public interface InputOutput<sUE : Any> : StatementIODeclarationScope<sUE>, Input<sUE>, Output<sUE>
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.statement
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
|
||||
@Suppress("ClassName")
|
||||
public interface _Statement<sUE : Any?> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: sUE
|
||||
|
||||
public interface Void2Void<sUE : Any?> : _Statement<sUE>
|
||||
public interface Void2Row<sUE : Any> : _Statement<sUE>
|
||||
public interface Void2RowOrNull<sUE : Any> : _Statement<sUE>
|
||||
public interface Void2Table<sUE : Any> : _Statement<sUE>
|
||||
public interface Params2Void<sUE : Any> : _Statement<sUE>
|
||||
public interface Params2Row<sUE : Any> : _Statement<sUE>
|
||||
public interface Params2RowOrNull<sUE : Any> : _Statement<sUE>
|
||||
public interface Params2Table<sUE : Any> : _Statement<sUE>
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.DatabaseType
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LifeTime
|
||||
|
||||
public interface Column<RT, tUE : Any> {
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("name")
|
||||
public val name: String
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("type")
|
||||
public val type: DatabaseType.ImplementationsProvider<RT>
|
||||
|
||||
@ReflectionApi
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("getTable")
|
||||
public val table: Table<tUE, *>
|
||||
|
||||
@ReflectionApi
|
||||
public val lifeTime: LifeTime
|
||||
|
||||
public val unwrappedColumn: Column<RT, tUE>
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LifeTime
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.module.Module
|
||||
import ru.landgrafhomyak.db.skeleton1.api.module.ModuleScopedObject
|
||||
|
||||
public interface Table<UE : Any, mUE : Any> {
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@get:JvmName("uExt")
|
||||
public val uExt: UE
|
||||
|
||||
public val unwrappedTable: Table<UE, mUE>
|
||||
|
||||
@ReflectionApi
|
||||
public val pathFromParentModuleRoot: List<String>
|
||||
|
||||
@ReflectionApi
|
||||
public val parentModule: Module<mUE>
|
||||
|
||||
@ReflectionApi
|
||||
public val lifeTime: LifeTime
|
||||
|
||||
@ReflectionApi
|
||||
public fun memberColumns(scope: LifeTime): Collection<Column<*, UE>>
|
||||
|
||||
@ReflectionApi
|
||||
public fun memberObjects(scope: LifeTime): Collection<TableScopedObject<UE>>
|
||||
|
||||
public interface Constructor<tUE : Any> {
|
||||
public fun createTable(context: TableConstructorScope<tUE>): tUE
|
||||
}
|
||||
|
||||
public interface Upgrade<tnUE : Any, toUE : Any> {
|
||||
public fun upgradeTable(oldTable: toUE, context: TableUpgradeScope<tnUE, toUE>): tnUE
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.table
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.DatabaseType
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ObjectClass
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.RawStatement
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
|
||||
import ru.landgrafhomyak.db.skeleton1.api.runtime.InputRow
|
||||
|
||||
|
||||
public interface TableConstructorScope<tUE : Any> {
|
||||
public fun <RT> column_create(name: String, type: DatabaseType.ImplementationsProvider<RT>): Column<RT, tUE>
|
||||
|
||||
public fun <RT> column_create(
|
||||
name: String, type: DatabaseType.ImplementationsProvider<RT>,
|
||||
alterCreateColumn: _Statement.Void2Void<*>
|
||||
): Column<RT, tUE>
|
||||
|
||||
public fun <RT> column_create(
|
||||
name: String, type: DatabaseType.ImplementationsProvider<RT>,
|
||||
alterCreateColumn: RawStatement.Void2Void.ImplementationsProvider<*>
|
||||
): Column<RT, tUE>
|
||||
|
||||
@LowLevelApi
|
||||
public fun <RT, sUE : Any> _column_create(
|
||||
name: String, type: DatabaseType.ImplementationsProvider<RT>,
|
||||
alterCreateColumn: _Statement.Void2Void<sUE>
|
||||
): InputRow._Scope<sUE, Column<RT, tUE>>
|
||||
|
||||
@LowLevelApi
|
||||
public fun <RT, sUE : Any> _column_create(
|
||||
name: String, type: DatabaseType.ImplementationsProvider<RT>,
|
||||
alterCreateColumn: RawStatement.Params2Void.ImplementationsProvider<sUE>
|
||||
): InputRow._Scope<sUE, Column<RT, tUE>>
|
||||
|
||||
public fun object_create(name: String, metadata: ObjectClass.ImplementationsProvider): TableScopedObject<tUE>
|
||||
|
||||
public fun addAlterStatement(stmt: _Statement.Void2Void<*>)
|
||||
public fun addAlterStatement(stmt: RawStatement.Void2Void.ImplementationsProvider<*>)
|
||||
|
||||
@LowLevelApi
|
||||
public fun <sUE : Any> _addAlterStatement(stmt: _Statement.Void2Void<sUE>): InputRow._Scope<sUE, Unit>
|
||||
|
||||
@LowLevelApi
|
||||
public fun <sUE : Any> _addAlterStatement(stmt: RawStatement.Params2Void.ImplementationsProvider<sUE>): InputRow._Scope<sUE, Unit>
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.table
|
||||
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LifeTime
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.ObjectClass
|
||||
|
||||
public interface TableScopedObject<tUE : Any> {
|
||||
@ReflectionApi
|
||||
public val name: String
|
||||
|
||||
@ReflectionApi
|
||||
public val parentTable: Table<tUE, *>
|
||||
|
||||
@ReflectionApi
|
||||
public val objectClassProvider: ObjectClass.ImplementationsProvider
|
||||
|
||||
@ReflectionApi
|
||||
public val lifeTime: LifeTime
|
||||
|
||||
public val unwrappedTableScopedObject: TableScopedObject<tUE>
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package ru.landgrafhomyak.db.skeleton1.api.table
|
||||
|
||||
import ru.landgrafhomyak.db.skeleton1.api.LowLevelApi
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement.RawStatement
|
||||
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
|
||||
import ru.landgrafhomyak.db.skeleton1.api.runtime.InputRow
|
||||
|
||||
public interface TableUpgradeScope<tnUE : Any, toUE : Any> : TableConstructorScope<tnUE> {
|
||||
public fun <RT> column_keep(c: Column<RT, toUE>): Column<RT, tnUE>
|
||||
public fun <RT> column_rename(c: Column<RT, toUE>, newName: String): Column<RT, tnUE>
|
||||
public fun column_delete(c: Column<*, toUE>)
|
||||
public fun <RT> column_deleteAfterTableUpgrade(c: Column<RT, toUE>): Column<RT, tnUE>
|
||||
|
||||
public fun object_keep(obj: TableScopedObject<toUE>): TableScopedObject<tnUE>
|
||||
public fun object_rename(obj: TableScopedObject<toUE>, newName: String): TableScopedObject<tnUE>
|
||||
public fun object_delete(obj: TableScopedObject<toUE>)
|
||||
public fun object_deleteAfterTableUpgrade(obj: TableScopedObject<toUE>): TableScopedObject<tnUE>
|
||||
|
||||
public fun addAlterStatementAfterUpgrade(stmt: _Statement.Void2Void<*>)
|
||||
public fun addAlterStatementAfterUpgrade(stmt: RawStatement.Void2Void.ImplementationsProvider<*>)
|
||||
|
||||
@LowLevelApi
|
||||
public fun <sUE : Any> _addAlterStatementAfterUpgrade(stmt: _Statement.Params2Void<sUE>): InputRow._Scope<sUE, Unit>
|
||||
|
||||
@LowLevelApi
|
||||
public fun <sUE : Any> _addAlterStatementAfterUpgrade(stmt: RawStatement.Params2Void.ImplementationsProvider<sUE>): InputRow._Scope<sUE, Unit>
|
||||
}
|
Loading…
Reference in New Issue
Block a user