@hedhog/prisma 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,5 +2,8 @@ import { OnModuleInit } from '@nestjs/common';
2
2
  import { PrismaClient } from '@prisma/client';
3
3
  export declare class PrismaService extends PrismaClient implements OnModuleInit {
4
4
  onModuleInit(): Promise<void>;
5
+ getProvider(): any;
6
+ isPostgres(): boolean;
7
+ isMysql(): boolean;
5
8
  }
6
9
  //# sourceMappingURL=prisma.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.service.d.ts","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBACa,aAAc,SAAQ,YAAa,YAAW,YAAY;IAC/D,YAAY;CAGnB"}
1
+ {"version":3,"file":"prisma.service.d.ts","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBACa,aAAc,SAAQ,YAAa,YAAW,YAAY;IAC/D,YAAY;IAIlB,WAAW;IAIX,UAAU;IAIV,OAAO;CAGR"}
@@ -13,6 +13,15 @@ let PrismaService = class PrismaService extends client_1.PrismaClient {
13
13
  async onModuleInit() {
14
14
  await this.$connect();
15
15
  }
16
+ getProvider() {
17
+ return this._engineConfig.activeProvider;
18
+ }
19
+ isPostgres() {
20
+ return this.getProvider() === 'postgresql';
21
+ }
22
+ isMysql() {
23
+ return this.getProvider() === 'mysql';
24
+ }
16
25
  };
17
26
  exports.PrismaService = PrismaService;
18
27
  exports.PrismaService = PrismaService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0D;AAC1D,2CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAAY;IAC7C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;CACF,CAAA;AAJY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAIzB"}
1
+ {"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["../src/prisma.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA0D;AAC1D,2CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAAY;IAC7C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,WAAW;QACT,OAAQ,IAAY,CAAC,aAAa,CAAC,cAAc,CAAC;IACpD,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC;IAC7C,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;IACxC,CAAC;CACF,CAAA;AAhBY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAgBzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/prisma",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -6,4 +6,16 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
6
6
  async onModuleInit() {
7
7
  await this.$connect();
8
8
  }
9
+
10
+ getProvider() {
11
+ return (this as any)._engineConfig.activeProvider;
12
+ }
13
+
14
+ isPostgres() {
15
+ return this.getProvider() === 'postgresql';
16
+ }
17
+
18
+ isMysql() {
19
+ return this.getProvider() === 'mysql';
20
+ }
9
21
  }