Condition

data class Condition(val field: String = EMPTY_VALUE, val operator: Operator = Operator.ALL, val value: Any = EMPTY_VALUE, val children: List<Condition> = emptyList(), val options: Map<String, Any> = emptyMap()) : ICondition<Condition> , RewritableCondition<Condition>

Represents a concrete query condition with support for various comparison operators and logical combinations.

This data class implements the ICondition interface and provides factory methods for creating common condition types. It supports both simple field comparisons and complex nested conditions using logical operators.

Samples

Constructors

Link copied to clipboard
constructor(field: String = EMPTY_VALUE, operator: Operator = Operator.ALL, value: Any = EMPTY_VALUE, children: List<Condition> = emptyList(), options: Map<String, Any> = emptyMap())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val children: List<Condition>

When operator is AND or OR or NOR, children cannot be empty.

Link copied to clipboard
open override val field: String

The field name to apply the condition to. Defaults to empty string for logical operators.

Link copied to clipboard
open override val operator: Operator

The comparison or logical operator to use. Defaults to Operator.ALL.

Link copied to clipboard
open override val options: Map<String, Any>

Additional configuration options like case sensitivity, date patterns, etc.

Link copied to clipboard
open override val value: Any

The value to compare against. Defaults to empty string.

Functions

Link copied to clipboard
open override fun appendCondition(append: Condition): Condition

Appends a condition to this condition using logical AND.

Link copied to clipboard
open fun appendTenantId(tenantId: String): Condition

Appends a tenant ID condition to filter results by tenant.

Link copied to clipboard

Gets the date pattern formatter for date parsing operations.

Link copied to clipboard

Extracts the deletion state from this condition.

Link copied to clipboard

Gets the case sensitivity option for string operations.

Link copied to clipboard
fun <V> valueAs(): V

Casts the condition value to the specified type.

Link copied to clipboard
open override fun withCondition(newCondition: Condition): Condition

Creates a new condition with the specified condition.

Link copied to clipboard
fun zoneId(): ZoneId?

Gets the timezone option for date/time operations.