Support for SQL 'UNION' operation

This commit is contained in:
Andrew Golovashevich 2025-02-15 23:19:34 +03:00
parent e33489bda1
commit a13a9858fb
2 changed files with 24 additions and 0 deletions

View File

@ -147,4 +147,27 @@ public interface SelectQuery<out qUE : Any> : _Query<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)
public val first: _Selectable<fqUE>
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> {
public val fq: _Selectable<fqUE>
public val lq: _Selectable<lqUE>
public val firstSubqueryParams: InputRow.WithRedirect<fqUE, qUE>
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>
}
}
}
} }

View File

@ -22,6 +22,7 @@ public interface _Query<out qUE : Any> {
public fun <qUE : Any, lUE : Any, rUE : Any> selectWithJoin(constructor: SelectQuery.WithJoin.Constructor<qUE, lUE, rUE>): SelectQuery.WithJoin<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> 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, 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 interface Scope : _SelectsScope {