@hedhog/prisma 0.0.3 → 0.0.4

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;IAKX,UAAU;IAIV,OAAO;CAGR"}
@@ -13,6 +13,16 @@ let PrismaService = class PrismaService extends client_1.PrismaClient {
13
13
  async onModuleInit() {
14
14
  await this.$connect();
15
15
  }
16
+ getProvider() {
17
+ console.log('getProvider', this._engineConfig.activeProvider);
18
+ return this._engineConfig.activeProvider;
19
+ }
20
+ isPostgres() {
21
+ return this.getProvider() === 'postgres';
22
+ }
23
+ isMysql() {
24
+ return this.getProvider() === 'mysql';
25
+ }
16
26
  };
17
27
  exports.PrismaService = PrismaService;
18
28
  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,OAAO,CAAC,GAAG,CAAC,aAAa,EAAG,IAAY,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QACvE,OAAQ,IAAY,CAAC,aAAa,CAAC,cAAc,CAAC;IACpD,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC;IAC3C,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC;IACxC,CAAC;CACF,CAAA;AAjBY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAiBzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/prisma",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -6,4 +6,17 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
6
6
  async onModuleInit() {
7
7
  await this.$connect();
8
8
  }
9
+
10
+ getProvider() {
11
+ console.log('getProvider', (this as any)._engineConfig.activeProvider);
12
+ return (this as any)._engineConfig.activeProvider;
13
+ }
14
+
15
+ isPostgres() {
16
+ return this.getProvider() === 'postgres';
17
+ }
18
+
19
+ isMysql() {
20
+ return this.getProvider() === 'mysql';
21
+ }
9
22
  }