$ open source · GPL-3.0 — need a commercial license? imqueue.com →

query.needNesting() function

Whether a fields map asks for any of the model's relations.

Signature:

export function needNesting(model: typeof Model, fields: any): boolean;

Parameters

Parameter

Type

Description

model

typeof Model

Model whose associations to check against.

fields

any

Requested fields map.

Returns:

boolean

true when at least one key names an association.

Remarks

The cheap test for "does this query need joins at all", used to avoid building an include when the caller only wants columns.