SingleQuery

data class SingleQuery(val condition: Condition, val projection: Projection = Projection.ALL, val sort: List<Sort> = emptyList()) : ISingleQuery

Data class representing a query for retrieving a single item with optional filtering, projection, and sorting.

This class implements ISingleQuery and provides a concrete implementation for single-item queries. It supports all standard query operations but is optimized for scenarios where only one result is expected.

Samples

Constructors

Link copied to clipboard
constructor(condition: Condition, projection: Projection = Projection.ALL, sort: List<Sort> = emptyList())

Properties

Link copied to clipboard
open override val condition: Condition

The filtering condition to apply to the query.

Link copied to clipboard
open override val projection: Projection

The field projection to control which fields are included in the result.

Link copied to clipboard
open override val sort: List<Sort>

The sorting criteria to order results (useful when multiple matches exist).

Functions

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

Appends a condition to the existing condition using logical AND. This method combines the current condition with the appended condition.

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

Appends a tenant ID condition to filter results by tenant.

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

Creates a new SingleQuery with the specified condition.

Link copied to clipboard
open override fun withProjection(newProjection: Projection): ISingleQuery

Creates a new SingleQuery with the specified projection.