Skip to content

Commit

Permalink
readme and test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
www778878net committed Jul 15, 2021
1 parent 77bfa59 commit 8057db9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ let up = new UpInfo().getGuest();//Simulated user upload
mysql78.creatTb(up )
```

>>### Get a MySQL connection and do whatever you want and release the connection.
```
let con=await mysql78.getConnection( ) ;
//do something
await mysql78.releaseConnection(con);
```

>>### Adding log information
```
let up = new UpInfo().getGuest();//Simulated user upload
mysql78.isLog = true;
let back=await mysql78._addWarn("info info ", "kind", up) ;
//We can query the log by kind or apisys or apiobj or upid or upby...
```

***
>## 框架简要说明
>![后端服务](https://github.com/www778878net/node-date78/blob/main/assets/pic/services.jpeg)
Expand Down
27 changes: 26 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,32 @@ function loadjson(filepath) {
return data;
}
let mysql78 = new Mysql(config["mysql"]);


describe('test addwarn ', () => {
it(' return 1', () => {
let up = new UpInfo().getGuest();//Simulated user upload
mysql78.isLog = true;
return mysql78._addWarn("info info ", "kind", up).then(function (result) {

expect(result).to.equal(1);

})
//done(); // ֪ͨMocha²âÊÔ½áÊø
});
});

describe('test get and release con ', () => {
it(' return ok', () => {
return mysql78.getConnection().then(function (con) {
expect(con.config.database).to.equal("mysql");
mysql78.releaseConnection(con).then(function (result) {
expect(result).to.equal("ok");
})
})
//done(); // ֪ͨMocha²âÊÔ½áÊø
});
});

describe('test doT ', () => {
it(' return ok', () => {
let up = new UpInfo().getGuest();//Simulated user upload
Expand Down

0 comments on commit 8057db9

Please sign in to comment.