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 b64e01ce
authored
Dec 03, 2017
by
markablov
Committed by
Sushant
Dec 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(query-interface/createFunction): add ability to pass query options and add missing docs (#8742)
1 parent
4b634345
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
2 deletions
lib/query-interface.js
lib/query-interface.js
View file @
b64e01c
...
...
@@ -1122,8 +1122,37 @@ class QueryInterface {
}
}
createFunction
(
functionName
,
params
,
returnType
,
language
,
body
,
options
)
{
const
sql
=
this
.
QueryGenerator
.
createFunction
(
functionName
,
params
,
returnType
,
language
,
body
,
options
);
/**
* Create SQL function
*
* ```js
* queryInterface.createFunction(
* 'someFunction',
* [
* {type: 'integer', name: 'param', direction: 'IN'}
* ],
* 'integer',
* 'plpgsql',
* 'RETURN param + 1;',
* [
* 'IMMUTABLE',
* 'LEAKPROOF'
* ]
* );
* ```
*
* @param {String} functionName Name of SQL function to create
* @param {Array} params List of parameters declared for SQL function
* @param {String} returnType SQL type of function returned value
* @param {String} language The name of the language that the function is implemented in
* @param {String} body Source code of function
* @param {Array} optionsArray Extra-options for creation
* @param {Object} [options]
*
* @return {Promise}
*/
createFunction
(
functionName
,
params
,
returnType
,
language
,
body
,
optionsArray
,
options
)
{
const
sql
=
this
.
QueryGenerator
.
createFunction
(
functionName
,
params
,
returnType
,
language
,
body
,
optionsArray
);
options
=
options
||
{};
if
(
sql
)
{
...
...
@@ -1133,6 +1162,25 @@ class QueryInterface {
}
}
/**
* Drop SQL function
*
* ```js
* queryInterface.dropFunction(
* 'someFunction',
* [
* {type: 'varchar', name: 'param1', direction: 'IN'},
* {type: 'integer', name: 'param2', direction: 'INOUT'}
* ]
* );
* ```
*
* @param {String} functionName Name of SQL function to drop
* @param {Array} params List of parameters declared for SQL function
* @param {Object} [options]
*
* @return {Promise}
*/
dropFunction
(
functionName
,
params
,
options
)
{
const
sql
=
this
.
QueryGenerator
.
dropFunction
(
functionName
,
params
);
options
=
options
||
{};
...
...
@@ -1144,6 +1192,27 @@ class QueryInterface {
}
}
/**
* Rename SQL function
*
* ```js
* queryInterface.renameFunction(
* 'fooFunction',
* [
* {type: 'varchar', name: 'param1', direction: 'IN'},
* {type: 'integer', name: 'param2', direction: 'INOUT'}
* ],
* 'barFunction'
* );
* ```
*
* @param {String} oldFunctionName
* @param {Array} params List of parameters declared for SQL function
* @param {String} newFunctionName
* @param {Object} [options]
*
* @return {Promise}
*/
renameFunction
(
oldFunctionName
,
params
,
newFunctionName
,
options
)
{
const
sql
=
this
.
QueryGenerator
.
renameFunction
(
oldFunctionName
,
params
,
newFunctionName
);
options
=
options
||
{};
...
...
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