Package-level declarations

Types

Link copied to clipboard

Declare that a composite, auto-generated key of type KeyType. It is recommended to create object of this class only once.

Link copied to clipboard
Link copied to clipboard
annotation class RsColumn(val name: String = "", val isId: Boolean = false, val converter: KClass<out RsValueConverter> = RsNoOpConverter::class)

Map a property to a column.

Link copied to clipboard
annotation class RsConstructor

Specify which constructor to use. If constructor has no parameters, bean mode is used. Else, constructor mode is used.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.FIELD])
annotation class RsIgnore

Specify a property to ignore. Used only in bean mode.

Link copied to clipboard

Mark a property as a nested property. A nested property's class contains its own columns and nested/to-one/to-many properties.

Link copied to clipboard

Does nothing

Link copied to clipboard
annotation class RsToMany(val elementConverter: KClass<out RsValueConverter> = RsNoOpConverter::class, val classToMap: KClass<out Any> = Any::class)

Mark a property as a to-many collection. Use this when mapping values from the result of a JOIN statement. Must be of type List or Set with only one generic type parameter.

Link copied to clipboard

Mark a property as a to-one property. A to-one property's class contains its own columns and nested/to-one/to-many properties. A to-one property's class have to have at least 1 column marked as ID. If id column(s) is null, then the value of the to-one property is null.

Link copied to clipboard
Link copied to clipboard
class SingleAutoGenKey<KeyType : Any>(val columnName: String, val keyType: KClass<KeyType>) : DeclaredGeneratedKeys<KeyType>

Declare a single-column, auto-generated key of type KeyType. It is recommended to create object of this class only once.

Functions

Link copied to clipboard
fun <T : Any> parseToList(resultSet: ResultSet, clazz: Class<T>, initialArraySize: Int = 0): List<T>

Get columns' values of all rows as a list of DTOs of type clazz, then close ResultSet

Link copied to clipboard
fun <T : Any> parseToObject(resultSet: ResultSet, clazz: Class<T>): T?

Get columns' values of the first row as a DTO of type clazz, then close ResultSet

Link copied to clipboard
fun <T : Any> parseToScalar(resultSet: ResultSet): T?

Get value of the first column of the first row, then close ResultSet

Link copied to clipboard
fun <T : Any> parseToScalarList(resultSet: ResultSet, initialArraySize: Int = 0): List<T?>
Link copied to clipboard
fun <T : Any> ResultSet.toList(clazz: KClass<T>, initialArraySize: Int = 0): List<T>

Get columns' values of all rows as a list of DTOs of type clazz, then close ResultSet

Link copied to clipboard
fun <T : Any> ResultSet.toObject(clazz: KClass<T>): T?

Get columns' values of the first row as a DTO of type clazz, then close ResultSet

Link copied to clipboard
fun <T : Any> ResultSet.toScalar(): T?
Link copied to clipboard
fun <T : Any> ResultSet.toScalarList(initialArraySize: Int = 0): List<T?>