不要怂,就是干,撸起袖子干!

Commit 42927d3e by Simon Schick Committed by GitHub

fix(types): add duplicating option (#10871)

1 parent 48eafaa5
......@@ -1646,6 +1646,7 @@ class Model {
* @param {Object} [options.include[].through.where] Filter on the join model for belongsToMany relations
* @param {Array} [options.include[].through.attributes] A list of attributes to select from the join model for belongsToMany relations
* @param {Array<Object|Model|string>} [options.include[].include] Load further nested related models
* @param {boolean} [options.include[].duplicating] Mark the include as duplicating, will prevent a subquery from being used.
* @param {Array|Sequelize.fn|Sequelize.col|Sequelize.literal} [options.order] Specifies an ordering. Using an array, you can provide several columns / functions to order by. Each element can be further wrapped in a two-element array. The first element is the column / function to order by, the second is the direction. For example: `order: [['name', 'DESC']]`. In this way the column will be escaped, but the direction will not.
* @param {number} [options.limit] Limit for result
* @param {number} [options.offset] Offset for result
......
......@@ -374,6 +374,10 @@ export type Includeable = typeof Model | Association | IncludeOptions | { all: t
*/
export interface IncludeOptions extends Filterable, Projectable, Paranoid {
/**
* Mark the include as duplicating, will prevent a subquery from being used.
*/
duplicating?: boolean;
/**
* The model you want to eagerly load
*/
model?: typeof Model;
......
......@@ -11,6 +11,7 @@ class AssociatedModel extends Model {}
MyModel.findAll({
include: [
{
duplicating: true,
limit: 1,
model: AssociatedModel,
on: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!