couchbase-lite-ee-paging

Couchbase Lite Enterprise Edition – Paging Extensions

The paging extensions are built on Cash App's Multiplatform Paging, Google's AndroidX Paging with multiplatform support. Kotbase Paging provides a PagingSource which performs limit/offset paging queries based on a user-supplied database query.

Installation

kotlin {
sourceSets {
commonMain {
dependencies {
implementation("dev.kotbase:couchbase-lite-ee-paging:3.0.15-1.0.1")
}
}
}
}

Usage

// Uses kotlinx-serialization JSON processor
@Serializable
data class Hotel(val id: String, val type: String, val name: String)

val select = select(Meta.id, "type", "name")
val mapper = { json: String ->
Json.decodeFromString<Hotel>(json)
}
val queryProvider: From.() -> LimitRouter = {
where {
("type" equalTo "hotel") and
("state" equalTo "California")
}
.orderBy { "name".ascending() }
}

val pagingSource = QueryPagingSource(
EmptyCoroutineContext,
select,
database,
mapper,
queryProvider
)

Packages

Link copied to clipboard
common