Database
class Database(connection: Connection, dbType: SQLTypeTranslator) : Closeable
Content copied to clipboard
This is the entrypoint of the library.
Parameters
connection
Connection of the existing database.
db Type
Translator to create the SQL statements. Currently, either net.redstonecraft.sqlorm.translator.MySQLTranslator or net.redstonecraft.sqlorm.translator.SQLiteTranslator.
Constructors
Types
Functions
Link copied to clipboard
inline fun <T> avg(prop: KProperty<*>, noinline block: Database.Query.() -> List<Database.Query.Clause> = { emptyList() }): Double
Content copied to clipboard
fun avg(clazz: KClass<*>, prop: KProperty<*>, block: Database.Query.() -> List<Database.Query.Clause> = { emptyList() }): Double
Content copied to clipboard
Returns the average value of the fields matching the specified criteria.
Link copied to clipboard
inline fun <T> count(noinline block: Database.Query.() -> List<Database.Query.Clause> = { emptyList() }): Int
Content copied to clipboard
fun count(clazz: KClass<*>, block: Database.Query.() -> List<Database.Query.Clause> = { emptyList() }): Int
Content copied to clipboard
Counts the entries matching the specified criteria.
Link copied to clipboard
Create a new table from the definition of the data class.s
Create a new table from the definition of the data class.
Link copied to clipboard
Make this database current on the companion object.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T> query(noinline block: Database.Query.() -> List<Database.Query.Clause> = { emptyList() }): List<T>
Content copied to clipboard
fun query(clazz: KClass<*>, block: Database.Query.() -> List<Database.Query.Clause> = { emptyList() }): List<Any>
Content copied to clipboard
Query for entries matching the specified criteria.
Link copied to clipboard
inline fun <T> sum(prop: KProperty<*>, noinline block: Database.Query.() -> List<Database.Query.Clause> = { emptyList() }): Double
Content copied to clipboard
fun sum(clazz: KClass<*>, prop: KProperty<*>, block: Database.Query.() -> List<Database.Query.Clause> = { emptyList() }): Double
Content copied to clipboard
Sums up the fields matching the specified criteria.