KotlinTrader / com.doubleu.kotlintrader.database / DBHelper

DBHelper

object DBHelper

Helper methods for database interaction

Functions

getIdColumnNames fun getIdColumnNames(entity: Entity<*>): Array<String>

Returns the names of the id columns of the given entity

fun <T : Entity<*>> getIdColumnNames(): Array<String>
fun <T : Entity<*>> getIdColumnNames(entityClass: KClass<T>): Array<String>

Returns the names of the id columns of the given Entity

getTableName fun <T : Entity<*>> getTableName(entity: T): String

Returns the name of the database table associated with the given entity

fun <T : Entity<*>> getTableName(): String
fun <T : Entity<*>> getTableName(clazz: KClass<T>): String

Returns the name of the database table associated with the given Entity

getWhere fun getWhere(entity: Entity<*>): String

Returns a WHERE-clause that leads to the passed entity

onConnect fun onConnect(op: () -> Unit): Unit

Executes the given op when a Database Connection is established

onDisconnect fun onDisconnect(op: () -> Unit): Unit

Executes the given op when the Database Connection is lost

register fun register(): Unit

Registers the DBHelper to observe the Database

Extension Functions

valueOf fun Any?.valueOf(): String