Skip to content
/ fluks Public

Fluent native Kotlin interface to SQLite/SQLCipher for Android

License

Notifications You must be signed in to change notification settings

segabond/fluks

Repository files navigation

Release

fluks

Fluent native type-safe Kotlin interface to SQLite/SQLCipher

Usage

val users = Table("users")
val id = Column<Int>("id")
val name = Column<String?>("name")
val email = Column<String>("email")

val db = Connection(SQLiteDriver("/path/to/database.sqlite"))

if (!db.scalar<Boolean>(users.exists())) {
    db.exec(
        users.create {
            it.column(column = id, autoincrement = true, primaryKey = true)
            it.column(name)
            it.column(column = email, unique = true)
        }
    )
}

db.exec(
    users.insert {
        it[name] = "John Smith"
        it[email] = "john.smith@example.com"
    }
)


for (user in db.query(users.select())) {
    println("ID:${user[id]}, Name:${user[name]?:"no name"}, Email: ${user[email]}")"
}

Installation

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    // for SQLite
    compile 'net.skycanvas.flux:flux-core:0.1.7'
    // for SQLite + SQLCipher
    compile 'net.skycanvas.flux:flux-cipher:0.1.7'

}

About

Fluent native Kotlin interface to SQLite/SQLCipher for Android

Resources

License

Stars

Watchers

Forks

Packages

No packages published