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

Commit 1a53892c by andres112013 Committed by Sushant

fix(typings): `comparator` arg of `Sequelize.where` (#11843)

1 parent 566cfa93
Showing with 12 additions and 2 deletions
...@@ -1450,7 +1450,7 @@ export function or(...args: (WhereOperators | WhereAttributeHash | Where)[]): Or ...@@ -1450,7 +1450,7 @@ export function or(...args: (WhereOperators | WhereAttributeHash | Where)[]): Or
export function json(conditionsOrPath: string | object, value?: string | number | boolean): Json; export function json(conditionsOrPath: string | object, value?: string | number | boolean): Json;
export type AttributeType = Fn | Col | Literal | ModelAttributeColumnOptions | string; export type AttributeType = Fn | Col | Literal | ModelAttributeColumnOptions | string;
export type LogicType = Fn | Col | Literal | OrOperator | AndOperator | WhereOperators | string; export type LogicType = Fn | Col | Literal | OrOperator | AndOperator | WhereOperators | string | symbol | null;
/** /**
* A way of specifying attr = condition. * A way of specifying attr = condition.
...@@ -1470,7 +1470,7 @@ export type LogicType = Fn | Col | Literal | OrOperator | AndOperator | WhereOpe ...@@ -1470,7 +1470,7 @@ export type LogicType = Fn | Col | Literal | OrOperator | AndOperator | WhereOpe
* @param logic The condition. Can be both a simply type, or a further condition (`.or`, `.and`, `.literal` * @param logic The condition. Can be both a simply type, or a further condition (`.or`, `.and`, `.literal`
* etc.) * etc.)
*/ */
export function where(attr: AttributeType, comparator: string, logic: LogicType): Where; export function where(attr: AttributeType, comparator: string | symbol, logic: LogicType): Where;
export function where(attr: AttributeType, logic: LogicType): Where; export function where(attr: AttributeType, logic: LogicType): Where;
export default Sequelize; export default Sequelize;
...@@ -325,3 +325,13 @@ Sequelize.where( ...@@ -325,3 +325,13 @@ Sequelize.where(
[Op.notILike]: Sequelize.literal('LIT') [Op.notILike]: Sequelize.literal('LIT')
} }
) )
Sequelize.where(Sequelize.col("ABS"), Op.is, null);
Sequelize.where(
Sequelize.fn("ABS", Sequelize.col("age")),
Op.like,
Sequelize.fn("ABS", Sequelize.col("age"))
);
Sequelize.where(Sequelize.col("ABS"), null);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!