com.sxtanna.db.KueryTaskTable.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Kuery Show documentation
Show all versions of Kuery Show documentation
MySQL Kotlin DSL/ORM based on HikariCP
package com.sxtanna.db
import com.sxtanna.db.ext.Value
import com.sxtanna.db.struct.Table
import com.sxtanna.db.struct.base.Duplicate
import com.sxtanna.db.struct.statement.*
import kotlin.reflect.KProperty1
/**
* A [KueryTask] specific for the supplied [Table]
*/
class KueryTaskTable(private val table : Table, private val task : KueryTask) : Creator.TableCreator, Deleter.TableDeleter, Dropper.TableDropper, Inserter.TableInserter, Selector.TableSelector, Truncater.TableTruncater, Updater.TableUpdater {
//region Create statement
override fun create() = task.create(table)
//endregion
//region Delete statements
override fun delete() : Delete {
return task.delete(table)
}
override fun delete(rows : Collection) {
task.delete(table, rows)
}
override fun deleteAllRows() {
task.deleteAllRows(table)
}
//endregion
//region Drop statement
override fun drop() {
task.drop(table)
}
//endregion
//region Insert statements
override fun insert(rows : Collection) {
task.insert(table, rows)
}
override fun insert(duplicate : Duplicate>, rows : Collection) {
task.insert(table, duplicate, rows)
}
//endregion
//region Select statements
override fun select() = task.select(table)
override fun
select(prop : KProperty1) = task.select(table, prop)
override fun
select(prop1 : KProperty1,
prop2 : KProperty1) = task.select(table, prop1, prop2)
override fun
select(prop1 : KProperty1,
prop2 : KProperty1,
prop3 : KProperty1) = task.select(table, prop1, prop2, prop3)
override fun
select(prop1 : KProperty1,
prop2 : KProperty1,
prop3 : KProperty1,
prop4 : KProperty1) = task.select(table, prop1, prop2, prop3, prop4)
override fun
select(prop1 : KProperty1,
prop2 : KProperty1,
prop3 : KProperty1,
prop4 : KProperty1,
prop5 : KProperty1) = task.select(table, prop1, prop2, prop3, prop4, prop5)
//endregion
//region Truncate statement
override fun truncate() {
task.truncate(table)
}
//endregion
//region Update statements
override fun update() : Update = task.update(table)
override fun update(rows : Collection) = task.update(table, rows)
override fun update(vararg values : Value) = task.update(table, *values)
override fun updateAllRows(row : E) {
task.updateAllRows(table, row)
}
override fun updateAllRows(vararg values : Value) {
task.updateAllRows(table, *values)
}
//endregion
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy