KQLiteJsonObject

Represents com.kqlite.functions.JSON_OBJECT data stored within a KQLiteTable.jsonObjectColumn.

This interface provides a standardized way to interact with JSON object columns, using com.kqlite.functions.JSON_OBJECT functions. It allows storing JSON Object only. This type can be created using KQLiteTable.jsonObjectColumn

Example

object MyTable : KQLiteTable("my_table") {
val settings = jsonObjectColumn("settings") // Stores a JSON object only
}

// INSERT
MyTable.quickInsert {
// Inserting JSON Object
it.settings.bind(JSON_OBJECT("key1" to "value1", "key2" to "value2"))
}

// SELECT
val jsonData: KQLiteJsonObject? = cursor[MyTable.settings]
val jsonString = jsonData?.getText()
// Now 'jsonString' can be parsed with libraries like Gson, kotlinx.serialization, etc.

Author

MOHAMMAD AZIM ANSARI

See also