Skip to content

postgrelize / HasManyHasAssociationMixinOptions

Interface: HasManyHasAssociationMixinOptions ​

Defined in: src/associations/mixin-types.ts:184

Options of the hasX accessor of a hasMany association (Sequelize v6).

Example ​

ts
const options: HasManyHasAssociationMixinOptions = { transaction };

Extends ​

Properties ​

attributes? ​

optional attributes?: FindAttributeOptions

Defined in: src/model/select-options.ts:80

Selected attributes. All attributes when omitted.

Inherited from ​

HasManyGetAssociationsMixinOptions.attributes


benchmark? ​

optional benchmark?: boolean

Defined in: src/model/runtime.ts:17

Pass query duration to the logger.

Inherited from ​

HasManyGetAssociationsMixinOptions.benchmark


distinctOn? ​

optional distinctOn?: readonly unknown[]

Defined in: src/model/select-options.ts:104

postgrelize extension

SELECT DISTINCT ON (...): attributes or expressions. PostgreSQL extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.distinctOn


from? ​

readonly optional from?: Readonly<Record<string, FromSourceOption>>

Defined in: src/model/cte-builder.ts:104

postgrelize extension

Extra relations (FROM "Model", "alias"), keyed by alias; correlate them in where. PostgreSQL extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.from


group? ​

optional group?: unknown

Defined in: src/model/select-options.ts:84

GROUP BY attributes or expressions.

Inherited from ​

HasManyGetAssociationsMixinOptions.group


having? ​

optional having?: unknown

Defined in: src/model/select-options.ts:86

HAVING condition.

Inherited from ​

HasManyGetAssociationsMixinOptions.having


hooks? ​

optional hooks?: boolean

Defined in: src/model/find-options.ts:68

Run beforeFind / afterFind hooks.

Default Value ​

ts
true

Inherited from ​

HasManyGetAssociationsMixinOptions.hooks


include? ​

optional include?: IncludeOption

Defined in: src/model/find-options.ts:70

Eager-load associations through JOINs (or separate queries for separate includes).

Inherited from ​

HasManyGetAssociationsMixinOptions.include


limit? ​

optional limit?: number | null

Defined in: src/model/select-options.ts:88

Maximum number of rows; null or undefined for no limit.

Inherited from ​

HasManyGetAssociationsMixinOptions.limit


lock? ​

optional lock?: LockOption

Defined in: src/model/select-options.ts:92

Row lock (FOR UPDATE etc.); requires a transaction.

Inherited from ​

HasManyGetAssociationsMixinOptions.lock


logging? ​

optional logging?: false | LoggingFunction

Defined in: src/model/runtime.ts:15

SQL logger for this query, or false.

Inherited from ​

HasManyGetAssociationsMixinOptions.logging


nest? ​

optional nest?: boolean

Defined in: src/model/find-options.ts:56

With raw, build nested objects from dotted keys such as 'posts.title'.

Default Value ​

ts
false

Inherited from ​

HasManyGetAssociationsMixinOptions.nest


noWait? ​

optional noWait?: boolean

Defined in: src/model/select-options.ts:99

postgrelize extension

Add NOWAIT to the row lock so the query fails instead of waiting; only with lock. PostgreSQL extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.noWait


offset? ​

optional offset?: number | null

Defined in: src/model/select-options.ts:90

Number of rows to skip; null or undefined to skip none.

Inherited from ​

HasManyGetAssociationsMixinOptions.offset


order? ​

optional order?: readonly unknown[] | Order

Defined in: src/model/select-options.ts:82

Sort order: attribute names, [attribute, 'ASC' | 'DESC'] pairs or expressions.

Inherited from ​

HasManyGetAssociationsMixinOptions.order


paranoid? ​

optional paranoid?: boolean

Defined in: src/model/find-options.ts:65

For paranoid models: false includes soft-deleted rows.

Default Value ​

ts
true

Inherited from ​

HasManyGetAssociationsMixinOptions.paranoid


plain? ​

optional plain?: boolean

Defined in: src/model/find-options.ts:59

Return a single row instead of an array (set internally by findOne).

Default Value ​

ts
false

Inherited from ​

HasManyGetAssociationsMixinOptions.plain


raw? ​

optional raw?: boolean

Defined in: src/model/find-options.ts:53

Return plain row objects instead of model instances.

Default Value ​

ts
false

Inherited from ​

HasManyGetAssociationsMixinOptions.raw


rejectOnEmpty? ​

optional rejectOnEmpty?: boolean | Error

Defined in: src/model/find-options.ts:62

Throw EmptyResultError (or the given Error) when no row is found.

Default Value ​

ts
false

Inherited from ​

HasManyGetAssociationsMixinOptions.rejectOnEmpty


replacements? ​

optional replacements?: Replacements

Defined in: src/model/runtime.ts:43

Values of ? (array) or :name (object) placeholders written in raw SQL inside the options (where: literal('"a" = :a'), attributes: [[literal(...), 'x']]), as in Sequelize v6. Every value is sent as a bound parameter, never concatenated into the SQL text; arrays expand to a comma separated list of parameters.

Inherited from ​

HasManyGetAssociationsMixinOptions.replacements


retry? ​

optional retry?: Readonly<{ backoffBase?: number; backoffExponent?: number; backoffJitter?: number; match?: readonly RetryMatch[]; max?: number; name?: string; report?: (message, options, error?) => void; timeout?: number; }>

Defined in: src/model/runtime.ts:31

Retries this query when it fails, merged over the instance retry option (Sequelize v6). The connection acquisition is part of the retried work; a query that runs in a transaction is never retried.

Inherited from ​

HasManyGetAssociationsMixinOptions.retry


sample? ​

optional sample?: Readonly<{ method: "BERNOULLI" | "SYSTEM"; percent: number; seed?: number; }>

Defined in: src/model/select-options.ts:115

postgrelize extension

Read only a random sample of the model table (TABLESAMPLE). PostgreSQL extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.sample


scope? ​

optional scope?: string | boolean | string[]

Defined in: src/associations/mixin-types.ts:112

Scope to apply on the associated model, or false to remove its default scope.

Inherited from ​

HasManyHasAssociationMixinOptions.scope


skipLocked? ​

optional skipLocked?: boolean

Defined in: src/model/select-options.ts:94

Add SKIP LOCKED to the row lock; only with lock.

Inherited from ​

HasManyGetAssociationsMixinOptions.skipLocked


source? ​

readonly optional source?: string | Subquery

Defined in: src/model/cte-builder.ts:99

postgrelize extension

Read model rows from this relation instead of the model table: a CTE or table name, or a subquery such as a set operation (a.union(b)), aliased with the model name. Columns are named like the attributes. PostgreSQL extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.source


statementTimeout? ​

optional statementTimeout?: number

Defined in: src/model/runtime.ts:25

postgrelize extension

statement_timeout for this query only, in milliseconds (non-negative integer; 0 disables it). PostgreSQL cancels the statement with a DatabaseError (code 57014) when it runs longer. Outside a transaction the query runs in its own short transaction; inside one the previous timeout is restored afterwards. PostgreSQL extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.statementTimeout


subQuery? ​

optional subQuery?: boolean

Defined in: src/model/find-options.ts:72

false disables the sub-query used for limit combined with multi-row includes.

Inherited from ​

HasManyGetAssociationsMixinOptions.subQuery


tableAs? ​

optional tableAs?: string

Defined in: src/model/find-options.ts:77

Alias of the main table in FROM instead of the model name, so literals and col('alias.x') can refer to it (a v6 internal option that v6's typings omit). Ignored when include is set.

Inherited from ​

HasManyGetAssociationsMixinOptions.tableAs


transaction? ​

optional transaction?: Transaction | null

Defined in: src/model/runtime.ts:13

Transaction to run in; null forces running outside the CLS transaction.

Inherited from ​

HasManyGetAssociationsMixinOptions.transaction


useMaster? ​

optional useMaster?: boolean

Defined in: src/model/runtime.ts:36

postgrelize extension

Force the writer even for SELECTs when read replicas are configured. postgrelize extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.useMaster


where? ​

optional where?: WhereOptions<any>

Defined in: src/model/find-options.ts:50

Filter rows; see WhereOptions. All rows when omitted.

Inherited from ​

HasManyGetAssociationsMixinOptions.where


with? ​

readonly optional with?: Readonly<Record<string, Subquery | WriteStatement | Readonly<{ cycle?: Readonly<{ columns: readonly string[]; set: string; using: string; }>; materialized?: boolean; query: Subquery | WriteStatement; recursive?: Subquery; search?: Readonly<{ by: readonly string[]; mode?: "breadth" | "depth"; set: string; }>; unionAll?: boolean; }>>>

Defined in: src/model/cte-builder.ts:92

postgrelize extension

Common table expressions (WITH [RECURSIVE] ...). PostgreSQL extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.with


withTies? ​

optional withTies?: boolean

Defined in: src/model/select-options.ts:110

postgrelize extension

FETCH FIRST limit ROWS WITH TIES instead of LIMIT: also returns the rows that tie with the last one on the order columns. Needs limit and order. PostgreSQL extension.

Inherited from ​

HasManyGetAssociationsMixinOptions.withTies

Released under the MIT License.