Skip to main content

PrependCondition

@webda/ql


Function: PrependCondition()

PrependCondition(query?, condition?): string

Defined in: packages/ql/src/query.ts:109

Prepend a condition to an existing query string using AND logic

Parses both strings, merges them, and reconstructs the combined query. ORDER BY, LIMIT, and OFFSET clauses from the original query are preserved.

Parameters​

query?​

string = ""

existing query string (may include ORDER BY / LIMIT / OFFSET)

condition?​

string

condition to prepend (filter expression only)

Returns​

string

merged query string

Example​

PrependCondition("status = 'active' ORDER BY name LIMIT 10", "age > 18")
// => 'status = "active" AND age > 18 ORDER BY name LIMIT 10'