mssql-by-steve
v1.0.0
Published
A mssql wrapper that's actually easy to use
Downloads
6
Maintainers
Readme
mssql-by-steve
Finally, a mssql wrapper for the rest of us
Installation
npm install mssql-by-steveUsage
Create a new ts file, initialize SqlHelper
Option 1: Initialize with configuration:
import SqlHelper from 'mssql-by-steve';
SqlHelper.initialize({
user: "your_username",
password: "your_password",
server: "your_server",
database: "your_database"
});Option 2: initialize using environment variables:
import SqlHelper from 'mssql-by-steve';
SqlHelper.initializeFromEnv();
// Reads from: db_user, db_password, server, databaseExport SqlHelper then import it from anywhere in your application and use it:
import SqlHelper from 'path-to-your-initialization-file';
const result = await SqlHelper.executeSingle<string>(
'Text',
`SELECT SomeColumn FROM SomeTable WHERE SomeColumn = @someValue`,
[
{name: 'someValue', type: 'VarChar', value: 'SomeValue'}
]
);