Skip to content

Commit

Permalink
refactor: rename exports
Browse files Browse the repository at this point in the history
Removes _callback suffix from exports and bring some exports out of deprecation (single, scalar, etc).

"Sync" exports still use _async.
  • Loading branch information
thelindat committed Dec 23, 2021
1 parent 452d1ad commit f9c33be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 37 deletions.
29 changes: 0 additions & 29 deletions src/server/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,61 +22,32 @@ global.exports('executeSync', (query, parameters, invokingResource = GetInvoking
return sql_query('', invokingResource, query, parameters);
});

global.exports('single', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
sql_query('single', invokingResource, query, parameters, cb);
});

global.exports('singleSync', (query, parameters, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
return sql_query('single', invokingResource, query, parameters);
});

global.exports('scalar', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
sql_query('scalar', invokingResource, query, parameters, cb);
});

global.exports('scalarSync', (query, parameters, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
return sql_query('scalar', invokingResource, query, parameters);
});

global.exports('update', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
sql_query('update', invokingResource, query, parameters, cb);
});

global.exports('updateSync', (query, parameters, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
return sql_query('update', invokingResource, query, parameters);
});

global.exports('insert', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
sql_query('insert', invokingResource, query, parameters, cb);
});

global.exports('insertSync', (query, parameters, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
return sql_query('insert', invokingResource, query, parameters);
});

global.exports('transaction', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
sql_transaction(invokingResource, query, parameters, cb);
});

global.exports('transactionSync', (query, parameters, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
return sql_transaction(invokingResource, query, parameters);
});

global.exports('prepare', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
sql_execute(invokingResource, query, parameters, cb);
});

global.exports('prepareSync', (query, parameters, invokingResource = GetInvokingResource()) => {
if (deprecated !== undefined) deprecated(invokingResource);
return sql_execute(invokingResource, query, parameters);
Expand Down
16 changes: 8 additions & 8 deletions src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,58 @@ import sql_transaction from './db/transaction.js';
require('./versioncheck.js');
require('./deprecated.js');

global.exports('query_callback', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
global.exports('query', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
sql_query('', invokingResource, query, parameters, cb);
});

global.exports('query_async', (query, parameters, invokingResource = GetInvokingResource()) => {
return sql_query('', invokingResource, query, parameters);
});

global.exports('single_callback', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
global.exports('single', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
sql_query('single', invokingResource, query, parameters, cb);
});

global.exports('single_async', (query, parameters, invokingResource = GetInvokingResource()) => {
return sql_query('single', invokingResource, query, parameters);
});

global.exports('scalar_callback', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
global.exports('scalar', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
sql_query('scalar', invokingResource, query, parameters, cb);
});

global.exports('scalar_async', (query, parameters, invokingResource = GetInvokingResource()) => {
return sql_query('scalar', invokingResource, query, parameters);
});

global.exports('update_callback', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
global.exports('update', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
sql_query('update', invokingResource, query, parameters, cb);
});

global.exports('update_async', (query, parameters, invokingResource = GetInvokingResource()) => {
return sql_query('update', invokingResource, query, parameters);
});

global.exports('insert_callback', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
global.exports('insert', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
sql_query('insert', invokingResource, query, parameters, cb);
});

global.exports('insert_async', (query, parameters, invokingResource = GetInvokingResource()) => {
return sql_query('insert', invokingResource, query, parameters);
});

global.exports('transaction_callback', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
global.exports('transaction', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
sql_transaction(invokingResource, query, parameters, cb);
});

global.exports('transaction_async', (query, parameters, invokingResource = GetInvokingResource()) => {
return sql_transaction(invokingResource, query, parameters);
});

global.exports('execute_callback', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
global.exports('prepare', (query, parameters, cb, invokingResource = GetInvokingResource()) => {
sql_execute(invokingResource, query, parameters, cb);
});

global.exports('execute_async', (query, parameters, invokingResource = GetInvokingResource()) => {
global.exports('prepare_async', (query, parameters, invokingResource = GetInvokingResource()) => {
return sql_execute(invokingResource, query, parameters);
});

0 comments on commit f9c33be

Please sign in to comment.