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, E>

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

    /**
     * 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 : E) {
        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 [Truncater.truncate] instead**
     *
     * @see [Truncater.truncate]
     */
    fun  deleteAllRows(table : Table)


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

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

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

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

        /**
         * @see [Deleter.deleteAllRows]
         * @see [Truncater.truncate]
         */
        fun deleteAllRows()

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy