'RUNTIME_KEY' generic in namespace descriptor

This commit is contained in:
Andrew Golovashevich 2025-05-07 16:06:46 +03:00
parent 1e8cc55db0
commit 5b5ee0e7b7
6 changed files with 25 additions and 19 deletions

View File

@ -13,19 +13,19 @@ import ru.landgrafhomyak.db.sql_skeleton_0.api.table.TableScopedObject
public interface CreateModuleScope<mUE : Any, RUNTIME_KEY : Any> {
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("rootNs")
public val rootNs: Namespace<mUE>
public val rootNs: Namespace<mUE, RUNTIME_KEY>
public fun <tUE : Any> createTable(
lifeTime: Table.LifeTime = Table.LifeTime.DATABASE_SCOPE,
namespace: Namespace<mUE> = this.rootNs,
namespace: Namespace<mUE, RUNTIME_KEY> = this.rootNs,
name: String, initializer: TableConstructor<tUE, RUNTIME_KEY>
): Table<tUE, mUE, RUNTIME_KEY>
public fun moduleScopedObject(namespace: Namespace<mUE> = this.rootNs, name: String): ModuleScopedObject<mUE, RUNTIME_KEY>
public fun moduleScopedObject(namespace: Namespace<mUE, RUNTIME_KEY> = this.rootNs, name: String): ModuleScopedObject<mUE, RUNTIME_KEY>
public fun <mUE : Any> substituteModule(rootNs: Namespace<mUE>, template: ModuleTemplate<mUE>): Module<mUE, RUNTIME_KEY>
public fun <mUE : Any> substituteModule(rootNs: Namespace<mUE, RUNTIME_KEY>, template: ModuleTemplate<mUE>): Module<mUE, RUNTIME_KEY>
public fun namespace(parent: Namespace<mUE>, name: String): Namespace<mUE>
public fun namespace(parent: Namespace<mUE, RUNTIME_KEY>, name: String): Namespace<mUE, RUNTIME_KEY>
public fun addStatement(stmt: DialectResolver.Statement_Void2Void<*>)

View File

@ -21,5 +21,5 @@ public interface Module<mUE : Any, RUNTIME_KEY: Any> {
@DebugApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getParent")
public val parent: Module<*, RUNTIME_KEY>
public val parent: Module<*, RUNTIME_KEY>?
}

View File

@ -12,5 +12,5 @@ public interface ModuleScopedObject<mUE : Any, RUNTIME_KEY : Any> {
public val module: Module<mUE, RUNTIME_KEY>
@DebugApi
public val namespace: Namespace<mUE>
public val namespace: Namespace<mUE, RUNTIME_KEY>
}

View File

@ -3,17 +3,17 @@ package ru.landgrafhomyak.db.sql_skeleton_0.api.module
import kotlin.jvm.JvmName
import ru.landgrafhomyak.db.sql_skeleton_0.api.DebugApi
public interface Namespace<mUE : Any> {
public interface Namespace<mUE : Any, RUNTIME_KEY : Any> {
@DebugApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getName")
public val name: String
@DebugApi
@Suppress("INAPPLICABLE_JVM_NAME", "PropertyName")
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getPath")
public val path: List<String>
@DebugApi
public val module: Module
public val module: Module<mUE, RUNTIME_KEY>
}

View File

@ -9,8 +9,8 @@ public interface UpgradeModuleScope<nmUE : Any, omUE : Any, RUNTIME_KEY : Any> :
public fun <tUE : Any> keepTable(table: Table<tUE, omUE, RUNTIME_KEY>): Table<tUE, nmUE, RUNTIME_KEY>
public fun <tUE : Any> keepAndRenameTable(table: Table<tUE, omUE, RUNTIME_KEY>, newName: String): Table<tUE, nmUE, RUNTIME_KEY>
public fun <tUE : Any> keepAndRenameTable(table: Table<tUE, omUE, RUNTIME_KEY>, newNamespace: Namespace<nmUE>): Table<tUE, nmUE, RUNTIME_KEY>
public fun <tUE : Any> keepAndRenameTable(table: Table<tUE, omUE, RUNTIME_KEY>, newNamespace: Namespace<nmUE>, newName: String): Table<tUE, nmUE, RUNTIME_KEY>
public fun <tUE : Any> keepAndRenameTable(table: Table<tUE, omUE, RUNTIME_KEY>, newNamespace: Namespace<nmUE, RUNTIME_KEY>): Table<tUE, nmUE, RUNTIME_KEY>
public fun <tUE : Any> keepAndRenameTable(table: Table<tUE, omUE, RUNTIME_KEY>, newNamespace: Namespace<nmUE, RUNTIME_KEY>, newName: String): Table<tUE, nmUE, RUNTIME_KEY>
public fun <ntUE : Any, otUE : Any> upgradeTable(oldTable: Table<otUE, omUE, RUNTIME_KEY>, upgrade: TableUpgrade<ntUE, otUE, RUNTIME_KEY>): Table<ntUE, nmUE, RUNTIME_KEY>
public fun <ntUE : Any, otUE : Any> upgradeAndRenameTable(
@ -21,13 +21,13 @@ public interface UpgradeModuleScope<nmUE : Any, omUE : Any, RUNTIME_KEY : Any> :
public fun <ntUE : Any, otUE : Any> upgradeAndRenameTable(
table: Table<otUE, omUE, RUNTIME_KEY>,
newNamespace: Namespace<nmUE>,
newNamespace: Namespace<nmUE, RUNTIME_KEY>,
upgrade: TableUpgrade<ntUE, otUE, RUNTIME_KEY>
): Table<ntUE, nmUE, RUNTIME_KEY>
public fun <ntUE : Any, otUE : Any> upgradeAndRenameTable(
table: Table<otUE, omUE, RUNTIME_KEY>,
newNamespace: Namespace<nmUE>,
newNamespace: Namespace<nmUE, RUNTIME_KEY>,
upgrade: TableUpgrade<ntUE, otUE, RUNTIME_KEY>,
newName: String
): Table<ntUE, nmUE, RUNTIME_KEY>
@ -39,21 +39,21 @@ public interface UpgradeModuleScope<nmUE : Any, omUE : Any, RUNTIME_KEY : Any> :
public fun exportTable(table: Table<*, omUE, RUNTIME_KEY>)
public fun <tUE : Any> importTable(
namespace: Namespace<nmUE> = this.rootNs, name: String,
namespace: Namespace<nmUE, RUNTIME_KEY> = this.rootNs, name: String,
table: Table<tUE, *, RUNTIME_KEY>
): Table<tUE, nmUE, RUNTIME_KEY>
public fun <ntUE : Any, otUE : Any> importAndUpgradeTable(
namespace: Namespace<nmUE> = this.rootNs, name: String,
namespace: Namespace<nmUE, RUNTIME_KEY> = this.rootNs, name: String,
table: Table<otUE, *, RUNTIME_KEY>,
upgrade: TableUpgrade<ntUE, otUE, RUNTIME_KEY>
): Table<ntUE, nmUE, RUNTIME_KEY>
public fun <smUE : Any> keepModule(module: Module<smUE, RUNTIME_KEY>): Module<smUE, RUNTIME_KEY>
public fun <smUE : Any> keepAndMoveModule(oldModule: Module<smUE, RUNTIME_KEY>, newNs: Namespace<nmUE>): Module<smUE, RUNTIME_KEY>
public fun <smUE : Any> keepAndMoveModule(oldModule: Module<smUE, RUNTIME_KEY>, newNs: Namespace<nmUE, RUNTIME_KEY>): Module<smUE, RUNTIME_KEY>
public fun <smUE : Any> upgradeModule(oldModule: Module<*, RUNTIME_KEY>, template: ModuleTemplate<smUE>): Module<smUE, RUNTIME_KEY>
public fun <smUE : Any> upgradeAndMoveModule(oldModule: Module<*, RUNTIME_KEY>, newNs: Namespace<nmUE>, template: ModuleTemplate<smUE>): Module<smUE, RUNTIME_KEY>
public fun <smUE : Any> upgradeAndMoveModule(oldModule: Module<*, RUNTIME_KEY>, newNs: Namespace<nmUE, RUNTIME_KEY>, template: ModuleTemplate<smUE>): Module<smUE, RUNTIME_KEY>
public fun removeModule(oldModule: Module<*, RUNTIME_KEY>)
public fun <smUE : Any> removeModuleAfterUpgrade(oldModule: Module<smUE, RUNTIME_KEY>): Module<smUE, RUNTIME_KEY>

View File

@ -3,6 +3,7 @@ package ru.landgrafhomyak.db.sql_skeleton_0.api.table
import kotlin.jvm.JvmName
import ru.landgrafhomyak.db.sql_skeleton_0.api.DebugApi
import ru.landgrafhomyak.db.sql_skeleton_0.api.module.Module
import ru.landgrafhomyak.db.sql_skeleton_0.api.module.Namespace
public interface Table<UE : Any, mUE : Any, RUNTIME_KEY : Any> {
@Suppress("INAPPLICABLE_JVM_NAME")
@ -14,10 +15,15 @@ public interface Table<UE : Any, mUE : Any, RUNTIME_KEY : Any> {
@get:JvmName("getName")
public val name: String
@DebugApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getNamespace")
public val namespace: Namespace<mUE, RUNTIME_KEY>
@DebugApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getModule")
public val module: Module<*>
public val module: Module<mUE, RUNTIME_KEY>
public enum class LifeTime {
DATABASE_SCOPE,