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 0f505eff
authored
Apr 02, 2019
by
Simon Schick
Committed by
Sushant
Apr 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(types): add version property to init options (#10681)
1 parent
c9e48e48
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
types/lib/model.d.ts
types/test/models/User.ts
types/lib/model.d.ts
View file @
0f505ef
...
...
@@ -1029,7 +1029,7 @@ export interface ModelValidateOptions {
}
/**
* Interface for indexes property in
Define
Options
* Interface for indexes property in
Init
Options
*/
export
interface
ModelIndexesOptions
{
/**
...
...
@@ -1072,7 +1072,7 @@ export interface ModelIndexesOptions {
}
/**
* Interface for name property in
Define
Options
* Interface for name property in
Init
Options
*/
export
interface
ModelNameOptions
{
/**
...
...
@@ -1087,14 +1087,14 @@ export interface ModelNameOptions {
}
/**
* Interface for getterMethods in
Define
Options
* Interface for getterMethods in
Init
Options
*/
export
interface
ModelGetterOptions
{
[
name
:
string
]:
(
this
:
Model
)
=>
unknown
;
}
/**
* Interface for setterMethods in
Define
Options
* Interface for setterMethods in
Init
Options
*/
export
interface
ModelSetterOptions
{
[
name
:
string
]:
(
this
:
Model
,
val
:
any
)
=>
void
;
...
...
@@ -1389,6 +1389,16 @@ export interface ModelOptions<M extends Model = Model> {
* Allows defining additional getters that will be available on model instances.
*/
getterMethods
?:
ModelGetterOptions
;
/**
* Enable optimistic locking.
* When enabled, sequelize will add a version count attribute to the model and throw an
* OptimisticLockingError error when stale instances are saved.
* - If string: Uses the named attribute.
* - If boolean: Uses `version`.
* @default false
*/
version
?:
boolean
|
string
;
}
/**
...
...
types/test/models/User.ts
View file @
0f505ef
...
...
@@ -37,6 +37,7 @@ User.init(
username
:
DataTypes
.
STRING
,
},
{
version
:
true
,
getterMethods
:
{
a
()
{
return
1
;
...
...
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