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

com.sxtanna.db.struct.statement.delete.kt Maven / Gradle / Ivy

There is a newer version: 1.6
Show newest version
package com.sxtanna.db.struct.statement

import com.sxtanna.db.struct.Table
import com.sxtanna.db.type.Executed
import com.sxtanna.db.type.Targeted

/**
 * Describes an SQL "DELETE" statement
 */
interface Delete : Executed, Targeted, T>

/**
 * An object that can delete rows from a table
 */
interface DBDeleter {

    /**
     * Create a Delete statement for this table
     *  * Execute statement either by calling [Delete.execute]
     *  * or
     *  * Returning it from a Kuery#invoke block
     */
    fun  delete(table : Table) : Delete

    /**
     * Delete the supplied rows from this table
     *  * Executed automatically
     */
    fun  delete(table : Table, vararg rows : T) {
        delete(table, rows.toList())
    }

    /**
     * Delete the supplied rows from this table
     *  * Executed automatically
     */
    fun  delete(table : Table, rows : Collection)

    /**
     * Delete all rows from this table
     *  * Executed automatically
     *  * Can be undone
     *  * **Consider using [DBTruncater.truncate] instead**
     *
     * @see [DBTruncater.truncate]
     */
    fun  deleteAllRows(table : Table)


    /**
     * An object that can delete rows from its table
     */
    interface TableDeleter {

        /**
         * @see [DBDeleter.delete]
         */
        fun delete() : Delete

        /**
         * Deleter.delete(table : Table<T>, varargs rows : T)
         *
         * @sample [Cannot_link_to_specific_method][delete]
         */
        fun delete(vararg rows : T) {
            delete(rows.toList())
        }

        /**
         * Deleter.delete(table : Table<T>, rows : Collection<T>)
         *
         * @sample [Cannot_link_to_specific_method][delete]
         */
        fun delete(rows : Collection)

        /**
         * @see [DBDeleter.deleteAllRows]
         * @see [DBTruncater.truncate]
         */
        fun deleteAllRows()

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy