Options
All
  • Public
  • Public/Protected
  • All
Menu

The interface that Sequelize uses to talk to all databases.

This interface is available through sequelize.QueryInterface. It should not be commonly used, but it's referenced anyway, so it can be used.

Hierarchy

  • QueryInterface

Index

Properties

QueryGenerator

QueryGenerator: any

Returns the dialect-specific sql generator.

We don't have a definition for the QueryGenerator, because I doubt it is commonly in use separately.

sequelize

sequelize: Sequelize

Returns the current sequelize instance.

Methods

addColumn

addIndex

  • addIndex(tableName: string | Object, attributes: string[], options?: QueryOptions, rawTablename?: string): Promise<void>
  • Adds a new index to a table

    Parameters

    • tableName: string | Object
    • attributes: string[]
    • Optional options: QueryOptions
    • Optional rawTablename: string

    Returns Promise<void>

bulkDelete

  • bulkDelete(tableName: string, identifier: Object, options?: QueryOptions, model?: Model<any, any>): Promise<Object>
  • Deletes multiple rows at once

    Parameters

    • tableName: string
    • identifier: Object
    • Optional options: QueryOptions
    • Optional model: Model<any, any>

    Returns Promise<Object>

bulkInsert

  • bulkInsert(tableName: string, records: Object[], options?: QueryOptions, attributes?: string[] | string): Promise<Object>
  • Inserts multiple records at once

    Parameters

    • tableName: string
    • records: Object[]
    • Optional options: QueryOptions
    • Optional attributes: string[] | string

    Returns Promise<Object>

bulkUpdate

  • bulkUpdate(tableName: string, values: Object, identifier: Object, options?: QueryOptions, attributes?: string[] | string): Promise<Object>
  • Updates multiple rows at once

    Parameters

    • tableName: string
    • values: Object
    • identifier: Object
    • Optional options: QueryOptions
    • Optional attributes: string[] | string

    Returns Promise<Object>

changeColumn

commitTransaction

  • Commit an already started transaction

    Parameters

    Returns Promise<void>

createFunction

  • createFunction(functionName: string, params: any[], returnType: string, language: string, body: string, options?: QueryOptions): Promise<void>
  • Postgres only. Create a function

    Parameters

    • functionName: string
    • params: any[]
    • returnType: string
    • language: string
    • body: string
    • Optional options: QueryOptions

    Returns Promise<void>

createSchema

  • Queries the schema (table list).

    Parameters

    • Optional schema: string

      The schema to query. Applies only to Postgres.

    • Optional options: QueryInterfaceOptions

    Returns Promise<void>

createTable

  • Creates a table with specified attributes.

    Parameters

    • tableName: string | object

      Name of table to create

    • attributes: DefineAttributes

      Hash of attributes, key is attribute name, value is data type

    • Optional options: QueryOptions

      Query options.

    Returns Promise<void>

createTrigger

  • createTrigger(tableName: string, triggerName: string, timingType: string, fireOnArray: any[], functionName: string, functionParams: any[], optionsArray: string[], options?: QueryInterfaceOptions): Promise<void>
  • Postgres only. Creates a trigger on specified table to call the specified function with supplied parameters.

    Parameters

    • tableName: string
    • triggerName: string
    • timingType: string
    • fireOnArray: any[]
    • functionName: string
    • functionParams: any[]
    • optionsArray: string[]
    • Optional options: QueryInterfaceOptions

    Returns Promise<void>

databaseVersion

  • Return database version

    Parameters

    Returns Promise<string>

deferConstraints

  • Defer constraints

    Parameters

    Returns Promise<void>

delete

  • delete(instance: Instance<any>, tableName: string, identifier: Object, options?: QueryOptions): Promise<Object>
  • Deletes a row

    Parameters

    Returns Promise<Object>

describeTable

  • describeTable(tableName: string | object, options?: string | object): Promise<Object>
  • Describe a table

    Parameters

    • tableName: string | object
    • Optional options: string | object

    Returns Promise<Object>

dropAllEnums

  • Drops all defined enums

    Parameters

    Returns Promise<void>

dropAllSchemas

  • Drops all tables.

    Parameters

    Returns Promise<void>

dropAllTables

  • Drops all tables.

    Parameters

    Returns Promise<void>

dropFunction

  • Postgres only. Drops a function

    Parameters

    Returns Promise<void>

dropSchema

  • Drops the specified schema (table).

    Parameters

    • Optional schema: string

      The schema to query. Applies only to Postgres.

    • Optional options: QueryInterfaceOptions

    Returns Promise<void>

dropTable

  • dropTable(tableName: string, options?: QueryOptions): Promise<void>
  • Drops the specified table.

    Parameters

    • tableName: string

      Table name.

    • Optional options: QueryOptions

      Query options, particularly "force".

    Returns Promise<void>

dropTrigger

  • Postgres only. Drops the specified trigger.

    Parameters

    Returns Promise<void>

escape

  • escape(value?: string | number | Date): string
  • Escape a value (e.g. a string, number or date)

    Parameters

    • Optional value: string | number | Date

    Returns string

getForeignKeysForTables

  • Returns all foreign key constraints of a table

    Parameters

    Returns Promise<Object>

increment

  • increment(instance: Instance<any>, tableName: string, values: Object, identifier: Object, options?: QueryOptions): Promise<Object>
  • Increments a row value

    Parameters

    • instance: Instance<any>
    • tableName: string
    • values: Object
    • identifier: Object
    • Optional options: QueryOptions

    Returns Promise<Object>

insert

  • insert(instance: Instance<any>, tableName: string, values: Object, options?: QueryOptions): Promise<Object>
  • Inserts a new record

    Parameters

    Returns Promise<Object>

nameIndexes

  • nameIndexes(indexes: string[], rawTablename: string): Promise<void>
  • Put a name to an index

    Parameters

    • indexes: string[]
    • rawTablename: string

    Returns Promise<void>

quoteIdentifier

  • quoteIdentifier(identifier: string, force: boolean): string
  • Escape an identifier (e.g. a table or attribute name). If force is true, the identifier will be quoted even if the quoteIdentifiers option is false.

    Parameters

    • identifier: string
    • force: boolean

    Returns string

quoteIdentifiers

  • quoteIdentifiers(identifiers: string, force: boolean): string
  • Split an identifier into .-separated tokens and quote each part. If force is true, the identifier will be quoted even if the quoteIdentifiers option is false.

    Parameters

    • identifiers: string
    • force: boolean

    Returns string

quoteTable

  • quoteTable(identifier: string): string
  • Escape a table name

    Parameters

    • identifier: string

    Returns string

rawSelect

  • rawSelect(tableName: string, options: QueryOptions, attributeSelector: string | string[], model?: Model<any, any>): Promise<string[]>
  • Selects raw without parsing the string into an object

    Parameters

    • tableName: string
    • options: QueryOptions
    • attributeSelector: string | string[]
    • Optional model: Model<any, any>

    Returns Promise<string[]>

removeColumn

  • Removes a column from a table

    Parameters

    Returns Promise<void>

removeIndex

  • removeIndex(tableName: string, indexNameOrAttributes: string[] | string, options?: QueryInterfaceOptions): Promise<void>
  • Removes an index of a table

    Parameters

    Returns Promise<void>

renameColumn

  • renameColumn(tableName: string | object, attrNameBefore: string, attrNameAfter: string, options?: QueryInterfaceOptions): Promise<void>
  • Renames a column

    Parameters

    • tableName: string | object
    • attrNameBefore: string
    • attrNameAfter: string
    • Optional options: QueryInterfaceOptions

    Returns Promise<void>

renameFunction

  • renameFunction(oldFunctionName: string, params: any[], newFunctionName: string, options?: QueryInterfaceOptions): Promise<void>
  • Postgres only. Rename a function

    Parameters

    Returns Promise<void>

renameTable

  • Renames a table

    Parameters

    Returns Promise<void>

renameTrigger

  • renameTrigger(tableName: string, oldTriggerName: string, newTriggerName: string, options?: QueryInterfaceOptions): Promise<void>
  • Postgres only. Renames a trigger

    Parameters

    • tableName: string
    • oldTriggerName: string
    • newTriggerName: string
    • Optional options: QueryInterfaceOptions

    Returns Promise<void>

rollbackTransaction

  • Rollback ( revert ) a transaction that has'nt been commited

    Parameters

    Returns Promise<void>

select

  • select(model: Model<any, any>, tableName: string, options?: QueryOptions): Promise<Object[]>
  • Returns selected rows

    Parameters

    Returns Promise<Object[]>

setAutocommit

  • Set option for autocommit of a transaction

    Parameters

    Returns Promise<void>

setIsolationLevel

  • Set the isolation level of a transaction

    Parameters

    Returns Promise<void>

showAllSchemas

  • Queries all table names in the database.

    Parameters

    Returns Promise<Object>

showAllTables

  • Returns all tables

    Parameters

    Returns Promise<string[]>

showIndex

  • showIndex(tableName: string | Object, options?: QueryOptions): Promise<Object>
  • Shows the index of a table

    Parameters

    Returns Promise<Object>

startTransaction

  • Begin a new transaction

    Parameters

    Returns Promise<void>

update

  • update(instance: Instance<any>, tableName: string, values: Object, identifier: Object, options?: QueryOptions): Promise<Object>
  • Updates a row

    Parameters

    • instance: Instance<any>
    • tableName: string
    • values: Object
    • identifier: Object
    • Optional options: QueryOptions

    Returns Promise<Object>

upsert

  • upsert(tableName: string, values: Object, updateValues: Object, model: Model<any, any>, options?: QueryOptions): Promise<Object>
  • Inserts or Updates a record in the database

    Parameters

    • tableName: string
    • values: Object
    • updateValues: Object
    • model: Model<any, any>
    • Optional options: QueryOptions

    Returns Promise<Object>

Generated using TypeDoc