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

Commit b6d6787a by Evgeniy Committed by Sushant

fix(types): add literal to possible where options (#10990)

1 parent f2b0aec1
Showing with 9 additions and 2 deletions
......@@ -121,7 +121,7 @@ export interface ScopeOptions {
/**
* The type accepted by every `where` option
*/
export type WhereOptions = WhereAttributeHash | AndOperator | OrOperator | Where;
export type WhereOptions = WhereAttributeHash | AndOperator | OrOperator | Literal | Where;
/**
* Example: `[Op.any]: [2,3]` becomes `ANY ARRAY[2, 3]::INTEGER`
......
import { AndOperator, fn, Model, Op, OrOperator, Sequelize, WhereOperators, WhereOptions, where as whereFn } from 'sequelize';
import { AndOperator, fn, Model, Op, OrOperator, Sequelize, WhereOperators, WhereOptions, literal, where as whereFn } from 'sequelize';
import Transaction from '../lib/transaction';
class MyModel extends Model {
......@@ -266,6 +266,13 @@ where = whereFn('test', {
[Op.gt]: new Date(),
});
// Literal as where
where = literal('true')
MyModel.findAll({
where: literal('true')
})
// Where as having option
MyModel.findAll({
having: where
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!