Skip to content

Commit b78cc97

Browse files
committed
deps: update oracledb 2.2.0
add @types/oracledb add index.d.ts
1 parent dceb937 commit b78cc97

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

index.d.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/// <reference types="oracledb" />
2+
/// <reference types="egg" />
3+
import { IExecuteOptions, IExecuteReturn, IPoolAttributes, IConnection, IPromise } from 'oracledb';
4+
5+
interface OracleDB {
6+
config: any;
7+
getConnection(): Promise<OracleConnection>;
8+
execute(sql: string, bindParams: Object|Array<any>, options: IExecuteOptions): Promise<IExecuteReturn>;
9+
close(): Promise<void>;
10+
destroy(): Promise<void>;
11+
}
12+
13+
interface OracleConnection {
14+
/**
15+
* orabledb Connection
16+
*/
17+
_connection: IConnection;
18+
execute(sql: string, bindParams: Object|Array<any>, options: IExecuteOptions): Promise<IExecuteReturn>;
19+
rollback(): IPromise<void>;
20+
commit(): IPromise<void>;
21+
close(): IPromise<void>;
22+
}
23+
24+
interface ClinetConfig {
25+
user: string;
26+
password: string;
27+
connectString: string;
28+
}
29+
30+
interface SingleOracleConfig {
31+
client: ClinetConfig;
32+
app: Boolean;
33+
agent: Boolean;
34+
}
35+
36+
interface MultiOracleConfig {
37+
clients: {
38+
[key:string]: ClinetConfig;
39+
};
40+
app: Boolean;
41+
agent: Boolean;
42+
}
43+
44+
declare module 'egg' {
45+
interface Application {
46+
oracle: Singleton<OracleDB> | OracleDB;
47+
}
48+
interface Singleton<T> {
49+
get(id: string): T;
50+
}
51+
interface EggAppConfig {
52+
oracle: SingleOracleConfig | MultiOracleConfig;
53+
}
54+
}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egg-oracle",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Oracle database plugin for egg",
55
"eggPlugin": {
66
"name": "oracle"
@@ -13,7 +13,10 @@
1313
"database"
1414
],
1515
"dependencies": {
16-
"oracledb": "^2.0.15"
16+
"oracledb": "^2.2.0"
17+
},
18+
"optionalDependencies": {
19+
"@types/oracledb": "^1.11.34"
1720
},
1821
"devDependencies": {
1922
"autod": "^3.0.1",
@@ -38,6 +41,7 @@
3841
"autod": "autod"
3942
},
4043
"files": [
44+
"index.d.ts",
4145
"index.js",
4246
"app.js",
4347
"agent.js",

0 commit comments

Comments
 (0)