All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dbobjekts.metadata.column.AutoKeyColumn.kt Maven / Gradle / Ivy

There is a newer version: 0.6.0-RC2
Show newest version
package com.dbobjekts.metadata.column

import com.dbobjekts.api.AnyTable
import com.dbobjekts.api.exception.DBObjektsException

interface AutoKeyColumn : IsGeneratedPrimaryKey

class AutoKeyIntegerColumn(table: AnyTable, name: String, aggregateType: AggregateType?) :
    IntegerColumn(table, name, aggregateType), AutoKeyColumn {
    constructor(table: AnyTable, name: String) : this(table, name, null)
    override val nullable: NullableColumn = NullableIntegerColumn(table, name, aggregateType)

    override fun distinct() =
        throw DBObjektsException("distinct() operation is not supported on an auto-generated key, as this is most certainly not what you want. All values will be distinct.")

}

class AutoKeyLongColumn(table: AnyTable, name: String, aggregateType: AggregateType?) :
    LongColumn(table, name, aggregateType), AutoKeyColumn {
    constructor(table: AnyTable, name: String) : this(table, name, null)
    override val nullable: NullableColumn = NullableLongColumn(table, name, aggregateType)

    override fun distinct() =
        throw DBObjektsException("distinct() operation is not supported on an auto-generated key, as this is most certainly not what you want. All values will be distinct.")

}









© 2015 - 2024 Weber Informatics LLC | Privacy Policy