QueryField

sealed interface QueryField<T>

A logical field of a query model, by its path (state.price, aggregateId, items.0.sku), typed by the values T it holds: the DSL's comparisons take a value of that type, checked at compile time (STATE__PRICE gte BigDecimal("5.00")). The generated <State>Properties and <Context>Contract constants are typed by their state's fields; a dynamic key, named only at run time, is a QueryField<Any?> (QueryField of a path) and takes any value.

Two fields are equal when their paths are, whatever they are typed as: the type only checks code at compile time and never reaches the wire, where a field is its path. T is invariant, so a QueryField<String> takes no Int. Fields are built by QueryField and of; an application does not implement this interface.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val path: String

Functions

Link copied to clipboard
open fun absoluteTo(parent: QueryField<*>?): QueryField<T>

This field, absolute: under parent unless it already is.

Link copied to clipboard
open fun append(relative: QueryField<*>): QueryField<Any?>

The field at relative under this one.

Link copied to clipboard
open fun relativeTo(parent: QueryField<*>): QueryField<T>?

This field relative to parent, or null when it is not under it.