1.76.3 • Published 11 months ago

@biorate/mssql v1.76.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Mssql

Mssql raw connector

Examples:

import { inject, container, Types, Core } from '@biorate/inversion';
import { IConfig, Config } from '@biorate/config';
import { MssqlConnector, IMssqlConnector } from '@biorate/mssql';

class Root extends Core() {
  @inject(MssqlConnector) public connector: IMssqlConnector;
}

container.bind<IConfig>(Types.Config).to(Config).inSingletonScope();
container.bind<IMssqlConnector>(MssqlConnector).toSelf().inSingletonScope();
container.bind<Root>(Root).toSelf().inSingletonScope();

container.get<IConfig>(Types.Config).merge({
  Mssql: [
    {
      name: 'connection',
      options: {
        server: 'localhost',
        user: 'sa',
        password: 'admin_007',
        database: 'master',
        options: {
          trustServerCertificate: true,
        },
      },
    },
  ],
});

(async () => {
  const root = container.get<Root>(Root);
  await root.$run();
  await root.connector!.current?.query(
    `CREATE TABLE test (
         count int,
         text varchar(20)
      );`,
  );
  await root.connector!.current?.query(
    `INSERT INTO test (count, text) VALUES (1, 'test1'), (2, 'test2'), (3, 'test3');`,
  );
  console.log(await root.connector!.current?.query(`SELECT * FROM test;`));
  // {
  //   recordsets: [ [ [Object], [Object], [Object] ] ],
  //   recordset: [
  //     { count: 1, text: 'test1' },
  //     { count: 2, text: 'test2' },
  //     { count: 3, text: 'test3' }
  //   ],
  //  output: {},
  //   rowsAffected: [ 3 ]
  //  }
})();

Learn

  • Documentation can be found here - docs.

Release History

See the CHANGELOG

License

MIT

Copyright (c) 2021-present Leonid Levkin (llevkin)

1.76.3

11 months ago

1.65.4

1 year ago

1.54.0

1 year ago

1.38.2

2 years ago

1.38.3

2 years ago

1.38.1

2 years ago

1.38.4

2 years ago

1.42.2

2 years ago

1.42.1

2 years ago

1.30.12

2 years ago

1.29.0

2 years ago

1.28.1

2 years ago

1.28.0

2 years ago

1.26.0

2 years ago

1.27.2

2 years ago

1.27.0

2 years ago

1.27.1

2 years ago

1.24.0

2 years ago

1.20.1

3 years ago

1.19.1

3 years ago

1.14.0

3 years ago