Allowed queries creating at runtime throw module descriptor

This commit is contained in:
Andrew Golovashevich 2025-02-07 15:04:47 +03:00
parent bb25b2be72
commit aec144d37c
3 changed files with 12 additions and 9 deletions

View File

@ -55,15 +55,11 @@ public interface CreateModuleScope {
*/
public fun <tUE : Any> createTransactionScopeTemporaryTable(namespace: Namespace = this.rootNs, name: String, initializer: TableConstructor<tUE>): Table<tUE, Nothing>
public val queries: _Query.Constructor.Scope
public fun <tUE : Any> createModuleConfiguringScopeTemporaryTable(namespace: Namespace = this.rootNs, name: String, initializer: TableConstructor<tUE>): Table<tUE, Nothing>
public val temporarySubqueries: _Query.Constructor.Scope
public fun <R : Any> createQuery(creator: _Query.Constructor<R>): R
public val moduleConfiguringTemporaryQueries: _Query.Constructor.Scope
public fun <qUE : Any> createQuery(creator: _Query.Constructor<qUE>): qUE
public fun <qUE : Any> createModuleConfiguringTemporaryQuery(creator: _Query.Constructor<qUE>): qUE
public fun <R : Any> createModuleConfiguringScopeTemporaryQuery(creator: _Query.Constructor<R>): R
/**
* Replaces [specified namespace][rootNs] with schema provided by [template].

View File

@ -1,6 +1,7 @@
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.SynchronizedDatabase
/**
@ -13,6 +14,7 @@ public interface Module<mUE : Any> {
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("userExtension")
public val uExt: mUE
/**
* Version key internally used for automatically [upgrading modules][ModuleTemplate.CreateModuleTemplatesScope.upgradeTemplate]. For debugging.
*/
@ -26,4 +28,7 @@ public interface Module<mUE : Any> {
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("ownerDatabase")
public val ownerDatabase: SynchronizedDatabase<*>
public fun <R : Any> createQuery(c: _Query.Constructor<R>): R
}

View File

@ -12,10 +12,12 @@ public interface _Query<qUE : Any> {
public interface Params2Table<QueryUserExtension : Any> : _Query<QueryUserExtension>, _Selectable<QueryUserExtension>
public interface Void2Table<QueryUserExtension : Any> : _Query<QueryUserExtension>, _Selectable<QueryUserExtension>
public interface Constructor<qUE : Any> {
public fun createQuery(internalQueries: Scope, outQueries: Scope): qUE
public interface Constructor<R> {
public fun createQuery(internalQueries: Scope, outQueries: Scope): R
public interface _SelectsScope {
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>