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 c07098ad
authored
Sep 09, 2014
by
overlookmotel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bulkDelete hook aliases
1 parent
fbaf4ecb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
lib/hooks.js
lib/hooks.js
View file @
c07098a
...
...
@@ -37,7 +37,9 @@ var Utils = require('./utils')
var
Hooks
=
module
.
exports
=
function
()
{};
var
hookAliases
=
{
beforeDelete
:
'beforeDestroy'
,
afterDelete
:
'afterDestroy'
afterDelete
:
'afterDestroy'
,
beforeBulkDelete
:
'beforeBulkDestroy'
,
afterBulkDelete
:
'afterBulkDestroy'
};
Hooks
.
replaceHookAliases
=
function
(
hooks
)
{
...
...
@@ -205,6 +207,10 @@ Hooks.beforeDestroy = function(name, fn) {
return
Hooks
.
addHook
.
call
(
this
,
'beforeDestroy'
,
name
,
fn
);
};
Hooks
.
beforeDelete
=
function
(
name
,
fn
)
{
return
Hooks
.
addHook
.
call
(
this
,
'beforeDelete'
,
name
,
fn
);
};
/**
* A hook that is run after destroying a single instance
* @param {String} name
...
...
@@ -216,10 +222,6 @@ Hooks.afterDestroy = function(name, fn) {
return
Hooks
.
addHook
.
call
(
this
,
'afterDestroy'
,
name
,
fn
);
};
Hooks
.
beforeDelete
=
function
(
name
,
fn
)
{
return
Hooks
.
addHook
.
call
(
this
,
'beforeDelete'
,
name
,
fn
);
};
Hooks
.
afterDelete
=
function
(
name
,
fn
)
{
return
Hooks
.
addHook
.
call
(
this
,
'afterDelete'
,
name
,
fn
);
};
...
...
@@ -264,20 +266,32 @@ Hooks.afterBulkCreate = function(name, fn) {
* A hook that is run before destroing instances in bulk
* @param {String} name
* @param {Function} fn A callback function that is called with where, callback(err)
*
* @alias beforeBulkDelete
*/
Hooks
.
beforeBulkDestroy
=
function
(
name
,
fn
)
{
return
Hooks
.
addHook
.
call
(
this
,
'beforeBulkDestroy'
,
name
,
fn
);
};
Hooks
.
beforeBulkDelete
=
function
(
name
,
fn
)
{
return
Hooks
.
addHook
.
call
(
this
,
'beforeBulkDelete'
,
name
,
fn
);
};
/**
* A hook that is run after destroying instances in bulk
* @param {String} name
* @param {Function} fn A callback function that is called with where, callback(err)
*
* @alias afterBulkDelete
*/
Hooks
.
afterBulkDestroy
=
function
(
name
,
fn
)
{
return
Hooks
.
addHook
.
call
(
this
,
'afterBulkDestroy'
,
name
,
fn
);
};
Hooks
.
afterBulkDelete
=
function
(
name
,
fn
)
{
return
Hooks
.
addHook
.
call
(
this
,
'afterBulkDelete'
,
name
,
fn
);
};
/**
* A hook that is run after updating instances in bulk
* @param {String} name
...
...
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