# query.mergeQuery() function · @imqueue/pg-sequelize

Source: https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.query.mergequery/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-sequelize 4.2.0 — generated reference, not hand-written

Merges query-option fragments into one options object.

**Signature:**

```typescript
export function mergeQuery(queryOptions?: any, ...merge: any[]): any;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| queryOptions | any | _(Optional)_ Target, mutated in place. |
| merge | any\[\] | Fragments to merge, in order; falsy ones are skipped. |


**Returns:**

any

The same `queryOptions` object.

## Exceptions

TypeError when a fragment's property type conflicts with the target's.

## Remarks

Per property: an absent property is taken as-is, arrays are unioned with duplicates dropped, objects are shallow-assigned, and anything else is overwritten by the later value. A fragment whose property type disagrees with what is already there — a scalar where an array sits, say — throws rather than guessing.

MUTATES and returns `queryOptions`, so pass a fresh object unless sharing is what you want.

