Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matii96/nestjs-firebird
Firebird database package for nest.js
https://github.com/matii96/nestjs-firebird
Last synced: 14 days ago
JSON representation
Firebird database package for nest.js
- Host: GitHub
- URL: https://github.com/matii96/nestjs-firebird
- Owner: Matii96
- License: mit
- Created: 2020-09-05T07:53:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-18T14:42:59.000Z (almost 4 years ago)
- Last Synced: 2024-11-07T07:51:09.406Z (2 months ago)
- Language: TypeScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NestJS Firebird
## Description
[Firebird](https://firebirdsql.org/) module for [Nest](https://github.com/nestjs/nest). Wrapper for [node-firebird](https://github.com/hgourvest/node-firebird).
## Installation
```bash
$ npm i --save https://github.com/Matii96/nestjs-firebird.git
```## Quick Start
```
import { Module } from '@nestjs/common';
import { FirebirdModule } from '@nestjs/firebird';
import { AppController } from './app.controller';
import { AppService } from './app.service';@Module({
imports: [
FirebirdModule.forRoot({
host: '10.10.160.130',
port: 3025,
user: 'SYSDBA',
password: 'masterkey',
database: 'd:/database.fdb',
encoding: 'win1250' // Default: UTF-8
})
],
controllers: [AppController],
providers: [AppService]
})
export class AppModule {}```
## Usage
```
import { Injectable } from '@nestjs/common';
import { FirebirdService } from '@nestjs/firebird';@Injectable()
export class AppService {
public constructor(private fb: FirebirdService) {}public async SingleQuery() {
let result = await this.fb.Query<{ADD: number}>('SELECT ?+? FROM RDB$DATABASE', [1,1]);
console.log(result); // => [{ADD: 2}]
}public async Transaction() {
const transactionResult = await this.fb.Transaction<{ USERNAME: string }>(async t => {
let result1 = await this.fb.Query<{ADD: number}>('SELECT ?+? FROM RDB$DATABASE', [2,2], t);
let result2 = await this.fb.Query<{USERNAME: string}>('SELECT USERS.USERNAME FROM USERS', null, t);console.log(result1); // => [{ADD: 4}]
console.log(result2); // => [{USERNAME: 'John'}]
return result2;
})
console.log(transactionResult); // => [{USERNAME: 'John'}]
}
}
```## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
## License
Nest is [MIT licensed](LICENSE).