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 47c5f30f
authored
Apr 08, 2019
by
Simon Schick
Committed by
Sushant
Apr 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(types): add parent transaction and enhance `where` parameters (#10726)
1 parent
57aba974
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
2 deletions
types/lib/sequelize.d.ts
types/lib/transaction.d.ts
types/test/transaction.ts
types/test/where.ts
types/lib/sequelize.d.ts
View file @
47c5f30
...
@@ -1336,7 +1336,7 @@ export function or(...args: (WhereOperators | WhereAttributeHash | Where)[]): Or
...
@@ -1336,7 +1336,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
|
string
;
export
type
LogicType
=
Fn
|
Col
|
Literal
|
OrOperator
|
AndOperator
|
WhereOperators
|
string
;
/**
/**
* A way of specifying attr = condition.
* A way of specifying attr = condition.
...
...
types/lib/transaction.d.ts
View file @
47c5f30
...
@@ -129,6 +129,10 @@ export interface TransactionOptions extends Logging {
...
@@ -129,6 +129,10 @@ export interface TransactionOptions extends Logging {
isolationLevel
?:
Transaction
.
ISOLATION_LEVELS
;
isolationLevel
?:
Transaction
.
ISOLATION_LEVELS
;
type
?:
Transaction
.
TYPES
;
type
?:
Transaction
.
TYPES
;
deferrable
?:
string
|
Deferrable
;
deferrable
?:
string
|
Deferrable
;
/**
* Parent transaction.
*/
transaction
?:
Transaction
;
}
}
export
default
Transaction
;
export
default
Transaction
;
types/test/transaction.ts
View file @
47c5f30
...
@@ -29,3 +29,10 @@ async function transact() {
...
@@ -29,3 +29,10 @@ async function transact() {
}
}
transact
();
transact
();
async
function
nestedTransact
()
{
const
tr
=
await
sequelize
.
transaction
({
transaction
:
await
sequelize
.
transaction
(),
});
await
tr
.
commit
();
}
types/test/where.ts
View file @
47c5f30
import
{
AndOperator
,
fn
,
Model
,
Op
,
OrOperator
,
Sequelize
,
WhereOperators
,
WhereOptions
}
from
'sequelize'
;
import
{
AndOperator
,
fn
,
Model
,
Op
,
OrOperator
,
Sequelize
,
WhereOperators
,
WhereOptions
,
where
as
whereFn
}
from
'sequelize'
;
import
Transaction
from
'../lib/transaction'
;
import
Transaction
from
'../lib/transaction'
;
class
MyModel
extends
Model
{
class
MyModel
extends
Model
{
...
@@ -252,3 +252,7 @@ where = {
...
@@ -252,3 +252,7 @@ where = {
where
=
{
where
=
{
[
Op
.
gt
]:
fn
(
'NOW'
),
[
Op
.
gt
]:
fn
(
'NOW'
),
};
};
where
=
whereFn
(
'test'
,
{
[
Op
.
gt
]:
new
Date
(),
});
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