postgrelize / WhereOptions
Type Alias: WhereOptions<T> ​
WhereOptions<
T> =WhereAttributeHash<NoInfer<T>> |RequiredLogic<T> | readonlyWhereOptions<T>[] |Where|Literal|Fn|Json|Exists
Defined in: src/model/where-options.ts:227
where option of queries (Sequelize v6 WhereOptions).
A condition is an object keyed by attribute (equality, IN for arrays, or operators), a list of conditions (OR), or an expression (where(), literal(), fn(), ...). Values are always bound parameters.
Type Parameters ​
T ​
T = Record<string, unknown>
See ​
Example ​
ts
const w: WhereOptions<User> = {
active: true,
age: { [Op.between]: [18, 65] },
role: ['admin', 'editor'],
[Op.or]: [{ name: { [Op.iLike]: 'a%' } }, { email: { [Op.endsWith]: '@example.com' } }],
'$posts.title$': 'Hello',
};
const rows = await User.findAll({ where: w, include: [Post] });