FilterDsl

class FilterDsl

Builds a FilterExpression: each call adds one node, and the block's nodes are combined with AND (one node alone is the filter itself). A field is named by its path, as a string ("state.status") or as a QueryField, such as a generated <State>Properties constant; every field operator takes either.

  • Values are the JSON values the wire carries (a string, a number, a boolean) or a runtime value, such as an enum, which the backend compares as the JSON it writes as. eq null is IS_NULL and ne null is IS_NOT_NULL.

  • Combinators: and, or and nor take a block of operands; not negates its block, written on the wire as a NOR of one operand, since the protocol has no NOT.

  • Scopes: path prefixes the relative fields of its block with a path; elementMatch matches the elements of a collection, its block naming fields relative to an element. A field under the element's own path, such as a generated STATE__ITEMS__PRODUCT_ID inside STATE__ITEMS.elementMatch { }, is read relative to it.

Functions

Link copied to clipboard
fun String.afterNow(offset: Duration = Duration.ZERO, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)

The field is after the server's now + offset; a negative offset looks back, e.g. Duration.ofMinutes(-30).

fun QueryField<*>.afterNow(offset: Duration = Duration.ZERO, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun aggregateId(value: String)
Link copied to clipboard
fun aggregateIds(values: List<String>)
fun aggregateIds(vararg values: String)
Link copied to clipboard
fun and(block: FilterDsl.() -> Unit)
Link copied to clipboard
fun String.beforeNow(offset: Duration = Duration.ZERO, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)

The field is before the server's now + offset; offset defaults to zero, i.e. before now.

fun QueryField<*>.beforeNow(offset: Duration = Duration.ZERO, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.beforeToday(time: LocalTime, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)

BEFORE_TODAY: before time of today.

fun QueryField<*>.beforeToday(time: LocalTime, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
infix fun String.between(range: ClosedRange<*>)

BETWEEN the bounds of range, both included: "state.price" between 10..20.

infix fun <C : Comparable<C>> QueryField<in C>.between(range: ClosedRange<C>)

BETWEEN of range's bounds: a range of the field's type, or of a type a nullable or untyped field takes.

fun String.between(lowerBound: Any?, upperBound: Any?)

BETWEEN: the field lies in [lowerBound, upperBound], both bounds included.

fun <T> QueryField<T>.between(lowerBound: T, upperBound: T)
Link copied to clipboard
infix fun String.containsAll(values: Iterable<*>)
infix fun QueryField<*>.containsAll(values: Iterable<*>)
Link copied to clipboard
fun String.containsText(value: String, comparison: StringComparison = StringComparison.CASE_SENSITIVE)
fun QueryField<*>.containsText(value: String, comparison: StringComparison = StringComparison.CASE_SENSITIVE)
Link copied to clipboard
fun deletion(deletionState: DeletionState)
Link copied to clipboard
fun String.earlierDays(days: Int, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)

EARLIER_DAYS: before the last days days.

fun QueryField<*>.earlierDays(days: Int, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.elementMatch(block: FilterDsl.() -> Unit)

ELEMENT_MATCH: an element of this collection matches block, whose fields are relative to the element.

fun QueryField<*>.elementMatch(block: FilterDsl.() -> Unit)

ELEMENT_MATCH on this collection field, as String.elementMatch does.

Link copied to clipboard
fun String.endsWithText(value: String, comparison: StringComparison = StringComparison.CASE_SENSITIVE)
fun QueryField<*>.endsWithText(value: String, comparison: StringComparison = StringComparison.CASE_SENSITIVE)
Link copied to clipboard
infix fun String.eq(value: Any?)
infix fun <T> QueryField<T>.eq(value: T)
Link copied to clipboard
Link copied to clipboard
fun expression(expression: FilterExpression)

Adds a prebuilt filter expression unchanged at the current query context root.

EXPRESSION: compares the computed expression of each record with value.

Link copied to clipboard
infix fun String.gt(value: Any?)
infix fun <T> QueryField<T>.gt(value: T)
Link copied to clipboard
infix fun String.gte(value: Any?)
infix fun <T> QueryField<T>.gte(value: T)
Link copied to clipboard
fun id(value: String)
Link copied to clipboard
fun ids(values: List<String>)
fun ids(vararg values: String)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
infix fun String.isIn(values: Iterable<*>)
infix fun <T> QueryField<T>.isIn(values: Iterable<T>)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun String.lastMonth(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.lastMonth(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.lastWeek(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.lastWeek(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.lastYear(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.lastYear(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
infix fun String.lt(value: Any?)
infix fun <T> QueryField<T>.lt(value: T)
Link copied to clipboard
infix fun String.lte(value: Any?)
infix fun <T> QueryField<T>.lte(value: T)
Link copied to clipboard
fun matchAll()
Link copied to clipboard
fun matchNone()
Link copied to clipboard
infix fun String.ne(value: Any?)
infix fun <T> QueryField<T>.ne(value: T)
Link copied to clipboard
fun String.nextMonth(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.nextMonth(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.nextWeek(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.nextWeek(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.nextYear(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.nextYear(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun nor(block: FilterDsl.() -> Unit)
Link copied to clipboard
fun not(block: FilterDsl.() -> Unit)

Matches what block does not: NOR of the block's filter, its nodes combined with AND first.

Link copied to clipboard
Link copied to clipboard
infix fun String.notIn(values: Iterable<*>)
infix fun <T> QueryField<T>.notIn(values: Iterable<T>)
Link copied to clipboard
fun or(block: FilterDsl.() -> Unit)
Link copied to clipboard
fun ownerId(value: String)
Link copied to clipboard
fun String.path(block: FilterDsl.() -> Unit)

Applies block in the logical field path scope represented by this string.

fun QueryField<*>.path(block: FilterDsl.() -> Unit)

Applies block in the path scope of this field, as String.path does.

Link copied to clipboard
fun String.recentDays(days: Int, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)

RECENT_DAYS: within the last days days, today included.

fun QueryField<*>.recentDays(days: Int, zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
infix fun String.search(query: String)
infix fun QueryField<*>.search(query: String)
fun search(query: String, mode: SearchMode, vararg fields: String)
fun search(query: String, mode: SearchMode, vararg fields: QueryField<*>)

fun search(query: String, vararg fields: String)

SEARCH of query in fields, or in every searchable field of the model when none is named.

Link copied to clipboard
fun spaceId(value: String)
Link copied to clipboard
fun String.startsWithText(value: String, comparison: StringComparison = StringComparison.CASE_SENSITIVE)
fun QueryField<*>.startsWithText(value: String, comparison: StringComparison = StringComparison.CASE_SENSITIVE)
Link copied to clipboard
fun tenantId(value: String)
Link copied to clipboard
fun String.thisMonth(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.thisMonth(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.thisWeek(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.thisWeek(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.thisYear(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.thisYear(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.today(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.today(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.tomorrow(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.tomorrow(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
Link copied to clipboard
fun String.yesterday(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)
fun QueryField<*>.yesterday(zoneId: ZoneId? = null, datePattern: String? = null, timeUnit: TimeUnit = MILLIS)