File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,40 @@ $ npm i egg-oracle --save
34
34
35
35
## Usage
36
36
37
+ * open plugin
38
+
37
39
``` js
38
40
// {app_root}/config/plugin.js
39
41
exports .oracle = {
40
42
enable: true ,
41
43
package: ' egg-oracle' ,
42
44
};
43
45
```
46
+ * oracle attach in app
47
+
48
+ ``` js
49
+ // {app_root}/app/service/my_service.js
50
+ ' use strict' ;
44
51
52
+ module .exports = app => {
53
+ class MyService extends app .Service {
54
+ // example for getConnection
55
+ async foo () {
56
+ const connection = await app .oracle .getConnection ();
57
+ const result = await connnection .execute (' SELECT sysdate AS "date" FROM dual' );
58
+ connection .close ();
59
+ console .log (sesult .rows [0 ].date );
60
+ }
61
+ // it work
62
+ async foo2 () {
63
+ const result = await app .oracle .execute (' SELECT sysdate AS "date" FROM dual' );
64
+ connection .close ();
65
+ console .log (sesult .rows [0 ].date );
66
+ }
67
+ }
68
+ return MyService;
69
+ }
70
+ ```
45
71
## Configuration
46
72
47
73
``` js
You can’t perform that action at this time.
0 commit comments