[history/serdha] Nullable types
This commit is contained in:
parent
15bd20fe87
commit
f1f03815d5
@ -1,9 +1,9 @@
|
||||
package ru.landgrafhomyak.serdha.api.v0.ddl
|
||||
|
||||
public interface Column<RuntimeType, DatabaseType : ColumnType<RuntimeType & Any>, TableUserWrapper : Any> /*: Expression<RuntimeType, DatabaseType>*/ {
|
||||
public interface Column<RuntimeType, DatabaseType : ColumnType<RuntimeType>, TableUserExtension : Any> {
|
||||
public val name: String
|
||||
|
||||
public val type: DatabaseType
|
||||
|
||||
public val table: Table<TableUserWrapper, *>
|
||||
public val table: Table<TableUserExtension, *>
|
||||
}
|
@ -3,64 +3,52 @@ package ru.landgrafhomyak.serdha.api.v0.ddl
|
||||
import kotlin.jvm.JvmName
|
||||
import ru.landgrafhomyak.serdha.api.v0.Expression
|
||||
|
||||
public interface TableCreator<TableUserWrapper : Any> {
|
||||
public interface TableCreator<TableUserExtension : Any> {
|
||||
public val expressionBuilder: Expression.Builder<TableUserExtension>
|
||||
|
||||
/**
|
||||
* Offers column of type [D][type] with `NOT NULL` constraint named [name] and runtime type [RuntimeType].
|
||||
*
|
||||
* @return Descriptor of offered column for future operations.
|
||||
*/
|
||||
public fun <RuntimeType : Any, DatabaseType : ColumnType<RuntimeType>> column(name: String, type: DatabaseType): Column<RuntimeType, DatabaseType, TableUserWrapper>
|
||||
public fun <RuntimeType : Any, DatabaseType : ColumnType<RuntimeType>> column(name: String, type: DatabaseType): Column<RuntimeType, DatabaseType, TableUserExtension>
|
||||
|
||||
@Suppress("INAPPLICABLE_JVM_NAME")
|
||||
@JvmName("nullableColumn\$notNull")
|
||||
@Deprecated("This column can be not-null", replaceWith = ReplaceWith("this.column"))
|
||||
public fun <RuntimeType : Any, DatabaseType : ColumnType<RuntimeType>> nullableColumn(name: String, type: DatabaseType): Column<RuntimeType?, DatabaseType, TableUserWrapper> =
|
||||
this.nullableColumn<RuntimeType?, DatabaseType>(name, type)
|
||||
public fun index(name: String, vararg columns: Column<*, *, TableUserExtension>): Index<TableUserExtension>
|
||||
|
||||
/**
|
||||
* Offers column of type [D][type] named [name] and runtime type [R?][RuntimeType].
|
||||
*
|
||||
* @return Descriptor of offered column for future operations.
|
||||
*/
|
||||
public fun <RuntimeType, DatabaseType : ColumnType<RuntimeType & Any>> nullableColumn(name: String, type: DatabaseType): Column<RuntimeType?, DatabaseType, TableUserWrapper>
|
||||
public fun unique(name: String, distinctNulls: Boolean, vararg columns: Column<*, *, TableUserExtension>): UniqueConstraint<TableUserExtension>
|
||||
public fun check(name: String, constraint: Expression<Boolean, ColumnType.BOOLEAN, TableUserExtension>): CheckConstraint<TableUserExtension>
|
||||
|
||||
public fun index(name: String, vararg columns: Column<*, *, TableUserWrapper>): Index<TableUserWrapper>
|
||||
public fun rowIdColumn(): Column<RowId<TableUserExtension>, ColumnType<RowId<TableUserExtension>>, TableUserExtension>
|
||||
|
||||
// todo not-null column uniqueness
|
||||
public fun unique(name: String, distinctNulls: Boolean, vararg columns: Column<*, *, TableUserWrapper>): UniqueConstraint<TableUserWrapper>
|
||||
public fun check(name: String, constraint: Expression<Boolean, ColumnType.BOOLEAN, TableUserWrapper>): CheckConstraint<TableUserWrapper>
|
||||
|
||||
public fun rowIdColumn(): Column<RowId<TableUserWrapper>, ColumnType<RowId<TableUserWrapper>>, TableUserWrapper>
|
||||
|
||||
public fun rowIdUniqueConstraint(): UniqueConstraint<TableUserWrapper>
|
||||
public fun rowIdUniqueConstraint(): UniqueConstraint<TableUserExtension>
|
||||
|
||||
public fun <TargetTableUserWrapper : Any, ColumnType1 : ColumnType<*>> foreignKey(
|
||||
fromColumn: Column<*, ColumnType1, TableUserWrapper>,
|
||||
fromColumn: Column<*, ColumnType1, TableUserExtension>,
|
||||
toTable: Table<TargetTableUserWrapper, *>,
|
||||
toColumn: Column<*, ColumnType1, TargetTableUserWrapper>,
|
||||
onUpdate: ForeignKey.OnUpdateAction,
|
||||
onDelete: ForeignKey.OnDeleteAction
|
||||
): ForeignKey<TableUserWrapper, TargetTableUserWrapper>
|
||||
): ForeignKey<TableUserExtension, TargetTableUserWrapper>
|
||||
|
||||
public fun <TargetTableUserWrapper : Any, ColumnType1 : ColumnType<*>, ColumnType2 : ColumnType<*>> foreignKey(
|
||||
fromColumn1: Column<*, ColumnType1, TableUserWrapper>,
|
||||
fromColumn2: Column<*, ColumnType2, TableUserWrapper>,
|
||||
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<TableUserWrapper, TargetTableUserWrapper>
|
||||
): ForeignKey<TableUserExtension, TargetTableUserWrapper>
|
||||
|
||||
public fun <TargetTableUserWrapper : Any, ColumnType1 : ColumnType<*>, ColumnType2 : ColumnType<*>, ColumnType3 : ColumnType<*>> foreignKey(
|
||||
fromColumn1: Column<*, ColumnType1, TableUserWrapper>,
|
||||
fromColumn2: Column<*, ColumnType2, TableUserWrapper>,
|
||||
fromColumn3: Column<*, ColumnType3, TableUserWrapper>,
|
||||
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<TableUserWrapper, TargetTableUserWrapper>
|
||||
): ForeignKey<TableUserExtension, TargetTableUserWrapper>
|
||||
}
|
Loading…
Reference in New Issue
Block a user