Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit b6d6787a
authored
Jul 06, 2019
by
Evgeniy
Committed by
Sushant
Jul 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(types): add literal to possible where options (#10990)
1 parent
f2b0aec1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
types/lib/model.d.ts
types/test/where.ts
types/lib/model.d.ts
View file @
b6d6787
...
@@ -121,7 +121,7 @@ export interface ScopeOptions {
...
@@ -121,7 +121,7 @@ export interface ScopeOptions {
/**
/**
* The type accepted by every `where` option
* 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`
* Example: `[Op.any]: [2,3]` becomes `ANY ARRAY[2, 3]::INTEGER`
...
...
types/test/where.ts
View file @
b6d6787
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'
;
import
Transaction
from
'../lib/transaction'
;
class
MyModel
extends
Model
{
class
MyModel
extends
Model
{
...
@@ -266,6 +266,13 @@ where = whereFn('test', {
...
@@ -266,6 +266,13 @@ where = whereFn('test', {
[
Op
.
gt
]:
new
Date
(),
[
Op
.
gt
]:
new
Date
(),
});
});
// Literal as where
where
=
literal
(
'true'
)
MyModel
.
findAll
({
where
:
literal
(
'true'
)
})
// Where as having option
// Where as having option
MyModel
.
findAll
({
MyModel
.
findAll
({
having
:
where
having
:
where
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment