Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Creates a SelectResult that contains values for all properties matching the query. The result is a single CBLMutableDictionary whose key is the name of the data source.

Link copied to clipboard
infix fun Collection.as(alias: String): DataSource

Set an alias to the collection as a data source.

infix fun Database.as(alias: String): DataSource

Set an alias to the database as a data source.

infix fun Expression.as(alias: String): SelectResult.As

Specifies the alias for the Expression as a SelectResult object.

Link copied to clipboard
fun Query.asFlow(coroutineContext: CoroutineContext? = null): Flow<ResultSet>

Returns a Flow that emits the Query ResultSet every time the underlying data set changes.

Link copied to clipboard
fun <T : Any> Query.asObjectsFlow(factory: (String) -> T?): Flow<List<T>>
fun <T : Any> Query.asObjectsFlow(factory: (Map<String, Any?>) -> T?): Flow<List<T>>
fun <T : Any> Query.asObjectsFlow(coroutineContext: CoroutineContext?, factory: (String) -> T?): Flow<List<T>>
fun <T : Any> Query.asObjectsFlow(coroutineContext: CoroutineContext?, factory: (Map<String, Any?>) -> T?): Flow<List<T>>

Returns a Flow that maps the Query ResultSet to instances of a class that can be created using the given factory lambda.

Link copied to clipboard
inline fun Expression.between(lower: Instant, upper: Instant): Expression

Create a between expression that evaluates whether or not the current expression is between the given dates inclusively.

Link copied to clipboard

Binds the Replicator instance to the given Lifecycle.

Link copied to clipboard
infix inline fun Expression.contains(value: String): Expression

Creates an ARRAY_CONTAINS(expr, value) function that checks whether the current array expression contains the given value or not.

Link copied to clipboard
inline fun ResultSet.countResult(): Long

Read count result from selectCount.

Link copied to clipboard
operator fun Expression.div(expression: Expression): Expression
operator fun Expression.div(value: Double): Expression
operator fun Expression.div(value: Float): Expression
operator fun Expression.div(value: Int): Expression
operator fun Expression.div(value: Long): Expression
Link copied to clipboard
fun Collection.documentFlow(id: String, fetchContext: CoroutineContext = Dispatchers.IO): Flow<Document?>

A flow of a document's current state. Emits null if document is deleted. filterNotNull if this is undesired.

Link copied to clipboard
infix fun Expression.equalTo(boolean: Boolean): Expression
infix fun Expression.equalTo(double: Double): Expression
infix fun Expression.equalTo(float: Float): Expression
infix fun Expression.equalTo(int: Int): Expression
infix fun Expression.equalTo(long: Long): Expression
infix fun Expression.equalTo(string: String): Expression
infix fun Expression.equalTo(list: List<Any>): Expression

Create an equal to expression that evaluates whether or not the current expression is equal to the given expression.

Link copied to clipboard
infix fun FromRouter.from(collection: Collection): From
infix fun FromRouter.from(database: Database): From

Create and chain a FROM component for specifying the query's data source.

infix fun String.from(fromAlias: String): Expression

Specifies an alias name of the data source to query the property data from.

Link copied to clipboard
fun fullTextIndex(vararg properties: String): FullTextIndex

Create a full-text search index with the given properties to be used to perform the match operation against with.

Link copied to clipboard

Create a greater than expression that evaluates whether or not the current expression is greater than the given expression.

Link copied to clipboard

Create a greater than or equal to expression that evaluates whether or not the current expression is greater than or equal to the given expression.

Link copied to clipboard
fun GroupByRouter.groupBy(vararg properties: String): GroupBy

Create and chain a GroupBy object to group the query result.

Link copied to clipboard
infix fun Expression.lessThan(boolean: Boolean): Expression
infix fun Expression.lessThan(double: Double): Expression
infix fun Expression.lessThan(float: Float): Expression
infix fun Expression.lessThan(string: String): Expression

Create a less than expression that evaluates whether or not the current expression is less than the given expression.

Link copied to clipboard

Create a less than or equal to expression that evaluates whether or not the current expression is less than or equal to the given expression.

Link copied to clipboard
infix fun Expression.like(boolean: Boolean): Expression
infix fun Expression.like(double: Double): Expression
infix fun Expression.like(float: Float): Expression
infix fun Expression.like(int: Int): Expression
infix fun Expression.like(long: Long): Expression
infix fun Expression.like(string: String): Expression
infix fun Expression.like(date: Instant): Expression

Create a Like expression that evaluates whether or not the current expression is LIKE the given expression.

Link copied to clipboard
fun LimitRouter.limit(limit: Int, offset: Int? = null): Limit

Creates and chains a Limit object to skip the returned results for the given offset position and to limit the number of results to not more than the given limit value.

Link copied to clipboard
fun <T : Any> Flow<QueryChange>.mapToObjects(factory: (String) -> T?): Flow<List<T>>
fun <T : Any> Flow<QueryChange>.mapToObjects(factory: (Map<String, Any?>) -> T?): Flow<List<T>>
Link copied to clipboard
operator fun Expression.minus(expression: Expression): Expression
operator fun Expression.minus(value: Double): Expression
operator fun Expression.minus(value: Float): Expression
operator fun Expression.minus(value: Int): Expression
operator fun Expression.minus(value: Long): Expression
Link copied to clipboard
fun mutableArrayOf(vararg values: Any?): MutableArray

Creates a new MutableArray with content from the passed values. Allowed value types are List, Instant, Map, Number, null, String, Array, Blob, and Dictionary. If present, Lists, Arrays, Maps and Dictionaries may contain only the above types.

Link copied to clipboard

Creates a new MutableDictionary with content from the passed key/value pairs. Allowed value types are List, Instant, Map, Number, null, String, Array, Blob, and Dictionary. If present, Lists, Arrays, Maps and Dictionaries may contain only the above types.

Link copied to clipboard
fun mutableDocOf(vararg pairs: Pair<String, Any?>): MutableDocument

Creates a new Document with a new random UUID and the key/value pairs as the content. Allowed value types are List, Instant, Map, Number, null, String, Array, Blob, and Dictionary. If present, Lists, Arrays, Maps and Dictionaries may contain only the above types. The created document will be saved into a database when you call Database.save(Document) with this document object.

fun mutableDocOf(id: String?, vararg pairs: Pair<String, Any?>): MutableDocument

Creates a new Document with a given ID and content from the passed key/value pairs. If the id is null, the document will be created with a new random UUID. Allowed value types are List, Instant, Map, Number, null, String, Array, Blob, and Dictionary. The List and Map must contain only the above types. The created document will be saved into a database when you call the Database's save(Document) method with the document object given.

Link copied to clipboard

Creates a new MutableDocument with the key-value entries specified by the given block function.

Link copied to clipboard
fun not(expression: Expression): Expression

Create a negated expression to represent the negated result of the given expression.

Link copied to clipboard
infix inline fun Expression.notContains(value: String): Expression

Creates a NOT ARRAY_CONTAINS(expr, value) expression that checks whether the current array expression contains the given value or not and returns the negated result.

Link copied to clipboard

Create a NOT equal to expression that evaluates whether or not the current expression is not equal to the given expression.

Link copied to clipboard
infix fun OrderByRouter.orderBy(builder: OrderByBuilder.() -> Unit): OrderBy

Create and chain an ORDER BY component for specifying the ORDER BY clause of the query.

Link copied to clipboard
operator fun Expression.plus(expression: Expression): Expression
operator fun Expression.plus(value: Double): Expression
operator fun Expression.plus(value: Float): Expression
operator fun Expression.plus(value: Int): Expression
operator fun Expression.plus(value: Long): Expression
Link copied to clipboard

Create a property expression representing the value of the given property.

Link copied to clipboard
operator fun Expression.rem(expression: Expression): Expression
operator fun Expression.rem(value: Double): Expression
operator fun Expression.rem(value: Float): Expression
operator fun Expression.rem(value: Int): Expression
operator fun Expression.rem(value: Long): Expression
Link copied to clipboard
fun select(vararg results: SelectResult): Select
fun select(vararg properties: String): Select
fun select(expression: Expression, vararg expressions: Expression): Select
fun select(expression: Expression, result: SelectResult, vararg results: SelectResult): Select
fun select(expression: Expression, property: String, vararg properties: String): Select

Create a SELECT statement instance that you can use further (e.g. calling the from() function) to construct the complete query statement.

Link copied to clipboard
fun selectCount(alias: String = ""): Select

SELECT COUNT(*)

Link copied to clipboard
fun selectDistinct(vararg results: SelectResult): Select
fun selectDistinct(vararg properties: String): Select
fun selectDistinct(expression: Expression, vararg expressions: Expression): Select
fun selectDistinct(expression: Expression, result: SelectResult, vararg results: SelectResult): Select
fun selectDistinct(expression: Expression, property: String, vararg properties: String): Select

Create a SELECT DISTINCT statement instance that you can use further (e.g. calling the from() function) to construct the complete query statement.

Link copied to clipboard
operator fun Expression.times(expression: Expression): Expression
operator fun Expression.times(value: Double): Expression
operator fun Expression.times(value: Float): Expression
operator fun Expression.times(value: Int): Expression
operator fun Expression.times(value: Long): Expression
Link copied to clipboard
inline fun <T : Any> ResultSet.toObjects(factory: (String) -> T?): List<T>
inline fun <T : Any> ResultSet.toObjects(factory: (Map<String, Any?>) -> T?): List<T>

Maps the ResultSet to a List of objects that are created using the given factory lambda.

Link copied to clipboard
fun valueIndex(vararg properties: String): ValueIndex

Create a value index with the given properties to be indexed.

Link copied to clipboard
infix fun WhereRouter.where(builder: WhereBuilder.() -> Expression): Where

Create and chain a WHERE component for specifying the WHERE clause of the query.