Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bradoyler/sprocit
Promise-based API for executing SQL stored procedures
https://github.com/bradoyler/sprocit
Last synced: 11 days ago
JSON representation
Promise-based API for executing SQL stored procedures
- Host: GitHub
- URL: https://github.com/bradoyler/sprocit
- Owner: bradoyler
- Created: 2018-05-30T11:58:54.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-18T03:56:26.000Z (over 6 years ago)
- Last Synced: 2024-10-11T01:14:19.021Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![log](https://user-images.githubusercontent.com/425966/40876689-9c5cf2f4-6647-11e8-8b79-85822a3d1221.png)
Sproc it
***Sproc it*** is a Promise-based API for executing SQL stored procedures _(for Nodejs)_
> Work it, Sproc it, Do it, Make us
🎼 ...
Harder, Better, Faster, Stronger### Install
```
npm i sprocit
```### Create your config
```js
const config = {
provider: 'mssql', // only provider, for now
user: 'dbuser',
password: '---',
server: 'localhost',
database: 'master',
options: {
encrypt: false // true, for using Azure
}
}
```### Execute a Stored procedure
```js
const sp = require('sprocit').create()
const params = [{name: 'id', value: 1}]// just 'connect' then => 'execute'
sp.connect(config)
.then(db => {
db.exec('getItem', params)
.then(console.log) // logs results
})
```### Run a Query
```js
sp.connect(config)
.then(db => {
db.query('select * from items')
.then(console.log) // logs results
})
```See [tests](test/index.js) for advanced usage
TODO:
- Mocha tests with Chai assertions
- PostgreSQL support