不要怂,就是干,撸起袖子干!

Commit b64e01ce by markablov Committed by Sushant

feat(query-interface/createFunction): add ability to pass query options and add missing docs (#8742)

1 parent 4b634345
Showing with 71 additions and 2 deletions
...@@ -1122,8 +1122,37 @@ class QueryInterface { ...@@ -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 || {}; options = options || {};
if (sql) { if (sql) {
...@@ -1133,6 +1162,25 @@ class QueryInterface { ...@@ -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) { dropFunction(functionName, params, options) {
const sql = this.QueryGenerator.dropFunction(functionName, params); const sql = this.QueryGenerator.dropFunction(functionName, params);
options = options || {}; options = options || {};
...@@ -1144,6 +1192,27 @@ class QueryInterface { ...@@ -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) { renameFunction(oldFunctionName, params, newFunctionName, options) {
const sql = this.QueryGenerator.renameFunction(oldFunctionName, params, newFunctionName); const sql = this.QueryGenerator.renameFunction(oldFunctionName, params, newFunctionName);
options = options || {}; options = options || {};
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!