interface QueryInterfaceIndexOptions {
    [COMPLETES_TRANSACTION]?: boolean;
    benchmark?: boolean;
    bind?: BindOrReplacements;
    concurrently?: boolean;
    connection?: null | AbstractConnection;
    fieldMap?: FieldMap;
    fields?: (string | Fn | Literal | IndexField)[];
    include?: Literal | (string | Literal)[];
    instance?: Model<any, any>;
    logging?: false | ((sql, timing?) => void);
    mapToModel?: boolean;
    msg?: string;
    name?: string;
    nest?: boolean;
    operator?: string;
    parser?: null | string;
    plain?: boolean;
    prefix?: string;
    raw?: boolean;
    replacements?: {
        [key: string]: unknown;
    };
    retry?: Options;
    supportsSearchPath?: boolean;
    transaction?: null | Transaction;
    type?: IndexType;
    unique?: boolean;
    useMaster?: boolean;
    using?: string;
    where?: WhereOptions;
}

Hierarchy (view full)

Properties

[COMPLETES_TRANSACTION]?: boolean

Indicates if the query completes the transaction Internal only

benchmark?: boolean

Pass query execution time in milliseconds as second argument to logging function (options.logging).

Either an object of named parameter bindings in the format $param or an array of unnamed values to bind to $1, $2, etc in your SQL.

concurrently?: boolean

PostgreSQL will build the index without taking any write locks. Postgres only.

Default

false
connection?: null | AbstractConnection

The connection on which this query must be run. Mutually exclusive with Transactionable.transaction.

Can be used to ensure that a query is run on the same connection as a previous query, which is useful when configuring session options.

Specifying this option takes precedence over CLS Transactions. If a transaction is running in the current AsyncLocalStorage context, it will be ignored in favor of the specified connection.

fieldMap?: FieldMap

Map returned fields to arbitrary names for SELECT query type if options.fieldMaps is present.

fields?: (string | Fn | Literal | IndexField)[]

The fields to index.

include?: Literal | (string | Literal)[]

Non-key columns to be added to the lead level of the nonclustered index.

instance?: Model<any, any>

A sequelize instance used to build the return instance

logging?: false | ((sql, timing?) => void)

A function that gets executed while running the query to log the sql.

Type declaration

    • (sql, timing?): void
    • Parameters

      • sql: string
      • Optional timing: number

      Returns void

mapToModel?: boolean

Map returned fields to model's fields if options.model or options.instance is present. Mapping will occur before building the model instance.

msg?: string

The message to display if the unique constraint is violated.

name?: string

The name of the index. Defaults to model name + _ + fields concatenated

nest?: boolean

If true, transforms objects with . separated property names into nested objects using dottie.js. For example { 'user.username': 'john' } becomes { user: { username: 'john' }}. When nest is true, the query type is assumed to be 'SELECT', unless otherwise specified

Default

false
operator?: string

Index operator type. Postgres only

parser?: null | string

For FULLTEXT columns set your parser

plain?: boolean

Sets the query type to SELECT and return a single row

prefix?: string

Prefix to append to the index name.

raw?: boolean

If true, sequelize will not try to format the results of the query, or build an instance of a model from the result

replacements?: {
    [key: string]: unknown;
}

Only named replacements are allowed in query interface methods.

Type declaration

  • [key: string]: unknown
retry?: Options
supportsSearchPath?: boolean

If false do not prepend the query with the search_path (Postgres only)

transaction?: null | Transaction

The transaction in which this query must be run. Mutually exclusive with Transactionable.connection.

If the Sequelize disableClsTransactions option has not been set to true, and a transaction is running in the current AsyncLocalStorage context, that transaction will be used, unless null or another Transaction is manually specified here.

type?: IndexType

Index type. Only used by mysql. One of UNIQUE, FULLTEXT and SPATIAL

unique?: boolean

Should the index by unique? Can also be triggered by setting type to UNIQUE

Default

false
useMaster?: boolean

Force the query to use the write pool, regardless of the query type.

Default

false
using?: string

The method to create the index by (USING statement in SQL). BTREE and HASH are supported by mysql and postgres. Postgres additionally supports GIST, SPGIST, BRIN and GIN.

where?: WhereOptions

Optional where parameter for index. Can be used to limit the index to certain rows.