← Back to Stormify Documentation

Package-level declarations

Types

Link copied to clipboard
abstract class AutoTable : StormifyEntity

Base class for entities that support lazy auto-population from the database.

Link copied to clipboard
interface CRUDTable

Mixin interface that adds create, update, and delete convenience methods directly on an entity class, delegating to the default Stormify instance.

Link copied to clipboard
class db<T>(defaultValue: T) : ReadWriteProperty<Any?, T>

Property delegate that triggers auto-population from the database on first access. Use with AutoTable entities: properties delegated to db will lazily load the entity's data when read or written for the first time.

Link copied to clipboard
annotation class DbField(val name: String = "", val primaryKey: Boolean = false, val primarySequence: String = "", val autoIncrement: Boolean = false, val creatable: Boolean = true, val updatable: Boolean = true, val enumAsString: Boolean = false)

Controls how a Kotlin property maps to a database column with advanced configuration options.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class DbTable(val name: String = "")

Marks a Kotlin class as mapping to a specific database table.

Link copied to clipboard
interface DbValue

Interface for enum classes that need custom numeric mapping to the database.

Link copied to clipboard
class EntityMeta<T : Any>(val type: KClass<T>, val constructor: () -> T, val properties: List<PropertyMeta<T>>, val tableNameOverride: String?)

Compile-time metadata for a mapped entity class. Holds the class reference, a constructor lambda, property descriptors, and an optional table name override.

Link copied to clipboard
fun interface EntityRegistrar

Functional interface for entity registration callbacks. Typically generated by the annotation processor (annproc) to register EntityMeta at startup.

Link copied to clipboard

Registry for enum classes, used by native targets where reflection is not available. On JVM, enum operations use reflection directly and this registry is not needed. On native, the annotation processor generates calls to register at startup.

Link copied to clipboard
data class FieldInfo(val name: String, val dbName: String, val type: KClass<*>, val isPrimaryKey: Boolean, val isReference: Boolean, val isEnum: Boolean, val enumAsString: Boolean, val sequence: String?, val isAutoIncrement: Boolean, val isInsertable: Boolean, val isUpdatable: Boolean)

Describes a single mapped field (property) of an entity, including its database column name, type, and role in CRUD operations.

Link copied to clipboard

Built-in naming policies for converting Kotlin property/class names to database column/table names.

Link copied to clipboard
expect class NativeBigInteger

Platform-specific big integer type. Maps to java.math.BigInteger on JVM and ionspin BigInteger on Native.

actual typealias NativeBigInteger = BigInteger

Maps to java.math.BigInteger on JVM.

actual typealias NativeBigInteger = BigInteger
typealias NativeBigInteger = BigInteger

Maps to ionspin com.ionspin.kotlin.bignum.integer.BigInteger on Native.

Link copied to clipboard
class PropertyMeta<T : Any>(val name: String, val type: KClass<*>, val isReference: Boolean, val getter: (T) -> Any?, val setter: (T, Any?, Stormify) -> Unit, val dbNameOverride: String?, val isPrimaryKey: Boolean, val sequence: String?, val isAutoIncrement: Boolean = false, val isCreatable: Boolean = true, val isUpdatable: Boolean = true, val isTransient: Boolean = false, val isEnum: Boolean = false, val enumAsString: Boolean = false)

Describes a single property of an entity class, including its type, getter/setter lambdas, and database mapping overrides. Used by EntityMeta and the annotation processor.

Link copied to clipboard
sealed class Sp

Stored-procedure parameter. The three modes (IN / OUT / INOUT) are distinct subclasses so each carries exactly the API it needs:

Link copied to clipboard

SQL dialect definitions for different database systems.

Link copied to clipboard
open class Stormify(val dataSource: DataSource, registrars: EntityRegistrar)

The main ORM controller. Entry point for all database operations.

Link copied to clipboard
interface StormifyAware

Interface for objects that can be bound to a Stormify instance via attachTo.

Link copied to clipboard
abstract class StormifyEntity : StormifyAware

Base class for entities that carry a reference to the Stormify instance that loaded them. This allows entity-level operations (e.g. AutoTable.populate) to use the correct Stormify instance without requiring it as an explicit parameter.

Link copied to clipboard
class StormifyJ(dataSource: DataSource, registrars: EntityRegistrar)

Java-facing wrapper around Stormify. Exposes all CRUD, query, and transaction operations as idiomatic Java methods: takes Class<T> parameters (instead of Kotlin KClass<T>), returns Java collections, and accepts Consumer<T> / Runnable in place of Kotlin lambdas.

Link copied to clipboard

Cleanup facade for Stormify's library-wide shared state on the desktop / JVM target. Not available on Native, Android, or iOS / macOS — those platforms cannot encounter the problem this class is designed to solve, so it is intentionally absent from their APIs.

Link copied to clipboard
class TableInfo<T : Any>

Metadata container for a mapped entity class. Holds the table name, field mappings, primary key information, and pre-built SQL queries for CRUD operations.

Link copied to clipboard

Context for executing database operations within a transaction.

Link copied to clipboard

Java-facing wrapper around a TransactionContext. Exposes all CRUD and query operations as idiomatic Java methods that take Class<T> parameters (instead of Kotlin KClass<T>) and Consumer<T> / Runnable instead of Kotlin function types.

Link copied to clipboard
object TypeUtils

Utility class for type conversion with entity-aware fallback.

Properties

Link copied to clipboard

Whether this value is a platform-specific primitive type (e.g. java.math.BigDecimal on JVM).

Whether this value is a platform-specific primitive type (e.g. java.math.BigDecimal on JVM).

Whether this value is a platform-specific primitive type (e.g. java.math.BigDecimal on JVM).

Functions

Link copied to clipboard
fun <T : Any> T.create(): T

Inserts this entity into the database and returns it with generated values populated.

Link copied to clipboard
fun <T : Any> T.delete()

Deletes this entity from the database based on its primary key.

Link copied to clipboard
inline fun <D : Any> Any.details(propertyName: String? = null): List<D>

Returns all detail (child) entities of type D related to this parent through a foreign key.

inline fun <D : Any> Any.details(referenceField: ReferencePath): List<D>

Type-safe variant of details that accepts an annotation-processor-generated reference path (e.g. Paths.AuditEntry_.createdBy) instead of a string.

Link copied to clipboard
fun String.executeUpdate(vararg args: Any?): Int

Executes this SQL string as an UPDATE/INSERT/DELETE and returns the number of affected rows.

Link copied to clipboard
inline fun <T : Any> findAll(whereClause: String = "", vararg args: Any?): List<T>

Finds all entities of type T, optionally filtered by a whereClause.

Link copied to clipboard
inline fun <T : Any> findById(id: Any): T?

Finds a single entity of type T by its primary key id, or null if not found.

Link copied to clipboard
fun <T : Any> inOutParam(type: Class<T>, value: T): Sp.InOut<T>

Factory for an INOUT parameter — Java-friendly, uses Class<T>.

Link copied to clipboard
inline fun <T : Any> lazyDetails(propertyName: String = ""): ReadWriteProperty<Any?, List<T>>

Property delegate that lazy-loads child (detail) records on first access.

inline fun <T : Any> lazyDetails(referenceField: ReferencePath): ReadWriteProperty<Any?, List<T>>

Type-safe variant of lazyDetails that accepts an annotation-processor-generated reference path (e.g. Paths.AuditEntry_.modifiedBy) instead of a magic string. The compiler guarantees that the referenced property actually exists on the child type, so typos and renames are caught at build time instead of first query execution.

Link copied to clipboard
fun <T : Any> outParam(type: Class<T>): Sp.Out<T>

Factory for an OUT parameter — Java-friendly, uses Class<T>.

Link copied to clipboard
fun String.procedure(vararg args: Any?)

Calls the stored procedure named by this string. OUT/INOUT parameters use Sp.Out/Sp.InOut.

Link copied to clipboard
inline fun <T : Any> String.read(vararg args: Any?): List<T>

Executes this SQL string as a SELECT and returns all results as a list.

Link copied to clipboard
inline fun <T : Any> String.readCursor(vararg args: Any?, noinline consumer: (T) -> Unit): Int

Executes this SQL string as a SELECT and processes results row-by-row via consumer. Returns the row count.

Link copied to clipboard
inline fun <T : Any> String.readOne(vararg args: Any?): T?

Executes this SQL string as a SELECT and returns a single result, or null if none found.

Link copied to clipboard
fun spIn(value: Any?): Sp.In

Kotlin helper for an IN parameter. Equivalent to Sp.In(value). Note: raw values passed to procedure(...) are auto-wrapped as IN, so explicit wrapping is only needed for clarity or when the caller wants to differentiate an intended IN from a potential Sp instance being passed.

Link copied to clipboard
inline fun <T : Any> spInOut(value: T): Sp.InOut<T>

Reified Kotlin helper for an INOUT parameter. Equivalent to Sp.InOut(T::class, value).

Link copied to clipboard
inline fun <T : Any> spOut(): Sp.Out<T>

Reified Kotlin helper for an OUT parameter. Equivalent to Sp.Out(T::class).

Link copied to clipboard
@JvmName(name = "fromAndroidSQLiteDatabase")
fun Stormify(db: SQLiteDatabase): Stormify

Creates a Stormify instance from an Android SQLiteDatabase.

@JvmName(name = "fromJdbcDataSource")
fun Stormify(jdbcDataSource: DataSource, vararg registrars: EntityRegistrar): Stormify

Creates a Stormify instance from a JDBC DataSource.

Link copied to clipboard

Returns the default Stormify instance, or throws if none has been set.

Link copied to clipboard

Executes a block within a database transaction with automatic commit/rollback.

Link copied to clipboard
fun <T : Any> T.update(): T

Updates this entity in the database based on its primary key.