[history/serdha] Changing ForeignKey to ForeignRowReference
This commit is contained in:
parent
c2c5ab9a28
commit
c447770d71
@ -1,7 +1,6 @@
|
|||||||
package ru.landgrafhomyak.serdha.api.v0.ddl
|
package ru.landgrafhomyak.serdha.api.v0.ddl
|
||||||
|
|
||||||
import ru.landgrafhomyak.serdha.api.v0.Expression
|
import ru.landgrafhomyak.serdha.api.v0.Expression
|
||||||
import ru.landgrafhomyak.serdha.api.v0.LowLevelApi
|
|
||||||
|
|
||||||
public interface TableCreator<TableUserExtension : Any> {
|
public interface TableCreator<TableUserExtension : Any> {
|
||||||
public val expressionBuilder: Expression.Builder<TableUserExtension>
|
public val expressionBuilder: Expression.Builder<TableUserExtension>
|
||||||
@ -22,64 +21,15 @@ public interface TableCreator<TableUserExtension : Any> {
|
|||||||
@Suppress("PropertyName")
|
@Suppress("PropertyName")
|
||||||
public val rowId_uniqueConstraint: UniqueIndex<TableUserExtension>
|
public val rowId_uniqueConstraint: UniqueIndex<TableUserExtension>
|
||||||
|
|
||||||
@Suppress("FunctionName")
|
public fun <TargetTableUserWrapper : Any> selfRowReference(
|
||||||
@LowLevelApi
|
onDelete: ForeignRowReference.OnDeleteAction,
|
||||||
public fun <TargetTableUserWrapper : Any> _foreignKey(
|
toColumn: Column<RowId<TargetTableUserWrapper>, ColumnType.ROW_ID<TargetTableUserWrapper>, TargetTableUserWrapper>,
|
||||||
fromColumns: Array<Column<*, *, TableUserExtension>>,
|
): ForeignRowReference<TableUserExtension, TableUserExtension>
|
||||||
toTable: Table<TargetTableUserWrapper, *>,
|
|
||||||
toColumns: Array<Column<*, *, TargetTableUserWrapper>>,
|
|
||||||
onUpdate: ForeignKey.OnUpdateAction,
|
|
||||||
onDelete: ForeignKey.OnDeleteAction,
|
|
||||||
): ForeignKey<TableUserExtension, TargetTableUserWrapper>
|
|
||||||
|
|
||||||
@OptIn(LowLevelApi::class)
|
public fun <TargetTableUserWrapper : Any> foreignRowReference(
|
||||||
public fun <TargetTableUserWrapper : Any, ColumnType1 : ColumnType<*>> foreignKey(
|
fromColumn: Column<RowId<TargetTableUserWrapper>, ColumnType.ROW_ID<TargetTableUserWrapper>, TableUserExtension>,
|
||||||
fromColumn: Column<*, ColumnType1, TableUserExtension>,
|
|
||||||
toTable: Table<TargetTableUserWrapper, *>,
|
toTable: Table<TargetTableUserWrapper, *>,
|
||||||
toColumn: Column<*, ColumnType1, TargetTableUserWrapper>,
|
toColumn: Column<RowId<TargetTableUserWrapper>, ColumnType.ROW_ID<TargetTableUserWrapper>, TargetTableUserWrapper>,
|
||||||
onUpdate: ForeignKey.OnUpdateAction,
|
onDelete: ForeignRowReference.OnDeleteAction,
|
||||||
onDelete: ForeignKey.OnDeleteAction,
|
): ForeignRowReference<TableUserExtension, TargetTableUserWrapper>
|
||||||
): ForeignKey<TableUserExtension, TargetTableUserWrapper> = this._foreignKey(
|
|
||||||
fromColumns = arrayOf(fromColumn),
|
|
||||||
toTable = toTable,
|
|
||||||
toColumns = arrayOf(toColumn),
|
|
||||||
onUpdate = onUpdate,
|
|
||||||
onDelete = onDelete
|
|
||||||
)
|
|
||||||
|
|
||||||
@OptIn(LowLevelApi::class)
|
|
||||||
public fun <TargetTableUserWrapper : Any, ColumnType1 : ColumnType<*>, ColumnType2 : ColumnType<*>> foreignKey(
|
|
||||||
fromColumn1: Column<*, ColumnType1, TableUserExtension>,
|
|
||||||
fromColumn2: Column<*, ColumnType2, TableUserExtension>,
|
|
||||||
toTable: Table<TargetTableUserWrapper, *>,
|
|
||||||
toColumn1: Column<*, ColumnType1, TargetTableUserWrapper>,
|
|
||||||
toColumn2: Column<*, ColumnType2, TargetTableUserWrapper>,
|
|
||||||
onUpdate: ForeignKey.OnUpdateAction,
|
|
||||||
onDelete: ForeignKey.OnDeleteAction,
|
|
||||||
): ForeignKey<TableUserExtension, TargetTableUserWrapper> = this._foreignKey(
|
|
||||||
fromColumns = arrayOf(fromColumn1, fromColumn2),
|
|
||||||
toTable = toTable,
|
|
||||||
toColumns = arrayOf(toColumn1, toColumn2),
|
|
||||||
onUpdate = onUpdate,
|
|
||||||
onDelete = onDelete
|
|
||||||
)
|
|
||||||
|
|
||||||
@OptIn(LowLevelApi::class)
|
|
||||||
public fun <TargetTableUserWrapper : Any, ColumnType1 : ColumnType<*>, ColumnType2 : ColumnType<*>, ColumnType3 : ColumnType<*>> foreignKey(
|
|
||||||
fromColumn1: Column<*, ColumnType1, TableUserExtension>,
|
|
||||||
fromColumn2: Column<*, ColumnType2, TableUserExtension>,
|
|
||||||
fromColumn3: Column<*, ColumnType3, TableUserExtension>,
|
|
||||||
toTable: Table<TargetTableUserWrapper, *>,
|
|
||||||
toColumn1: Column<*, ColumnType1, TargetTableUserWrapper>,
|
|
||||||
toColumn2: Column<*, ColumnType2, TargetTableUserWrapper>,
|
|
||||||
toColumn3: Column<*, ColumnType3, TargetTableUserWrapper>,
|
|
||||||
onUpdate: ForeignKey.OnUpdateAction,
|
|
||||||
onDelete: ForeignKey.OnDeleteAction,
|
|
||||||
): ForeignKey<TableUserExtension, TargetTableUserWrapper> = this._foreignKey(
|
|
||||||
fromColumns = arrayOf(fromColumn1, fromColumn2, fromColumn3),
|
|
||||||
toTable = toTable,
|
|
||||||
toColumns = arrayOf(toColumn1, toColumn2, toColumn3),
|
|
||||||
onUpdate = onUpdate,
|
|
||||||
onDelete = onDelete
|
|
||||||
)
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user