KQLiteJsonArray

Represents com.kqlite.functions.JSON_ARRAY data stored within a KQLiteTable.jsonArrayColumn.

This interface provides a standardized way to interact with JSON array columns, using com.kqlite.functions.JSON_ARRAY functions. It allows storing JSON Array only. This type can be created using KQLiteTable.jsonArrayColumn

Example

object MyTable : KQLiteTable("my_table") {
val tags = jsonArrayColumn("tags") // Stores a JSON array only
}

// INSERT
MyTable.quickInsert {
// Inserting JSON Array
it.tags.bind(JSON_ARRAY("tag1", "tag2"))
}

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

Author

MOHAMMAD AZIM ANSARI

See also