androidMain.com.ditchoom.mqtt3.persistence.SqlDriver.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mqtt-4-models Show documentation
Show all versions of mqtt-4-models Show documentation
Defines the MQTT 3 and 4 control packets
package com.ditchoom.mqtt3.persistence
import android.content.Context
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.android.AndroidSqliteDriver
import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver
import com.ditchoom.Mqtt4
actual fun sqlDriver(androidContext: Any?, name: String, inMemory: Boolean): SqlDriver? = if (androidContext != null) {
AndroidSqliteDriver(
Mqtt4.Schema,
androidContext as Context,
if (inMemory) {
null
} else {
name
}
)
} else {
val driver = JdbcSqliteDriver(
if (inMemory) {
JdbcSqliteDriver.IN_MEMORY
} else {
name
}
)
Mqtt4.Schema.create(driver)
driver
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy