Skip to content

Commit 31ed369

Browse files
authored
feat: update ali-rds@6.4.0 (#30)
1 parent 70b9683 commit 31ed369

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egg-mysql",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"description": "MySQL plugin for egg",
55
"eggPlugin": {
66
"name": "mysql"
@@ -20,7 +20,7 @@
2020
"database"
2121
],
2222
"dependencies": {
23-
"ali-rds": "^5.1.2"
23+
"ali-rds": "^6.4.0"
2424
},
2525
"devDependencies": {
2626
"@eggjs/tsconfig": "^1.3.2",

test/mysql.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ describe('test/mysql.test.ts', () => {
9090
assert(row.id === user.id);
9191
});
9292

93+
it('should query with literal in where conditions', async () => {
94+
const user = await app.mysql.queryOne('select * from npm_auth where `password` is not NULL');
95+
assert(user);
96+
assert(typeof user.user_id === 'string' && user.user_id);
97+
98+
const row = await app.mysql.get('npm_auth', { password: new app.mysql.literals.Literal('is not NULL') });
99+
assert(row.id === user.id);
100+
});
101+
93102
it('should query one not exists return null', async () => {
94103
let user = await app.mysql.queryOne('select * from npm_auth where id = -1');
95104
assert(!user);
@@ -119,7 +128,7 @@ describe('test/mysql.test.ts', () => {
119128
const result = await app.mysql.beginTransactionScope(async conn => {
120129
const row = await conn.queryOne('select * from npm_auth order by id desc limit 10');
121130
return { row };
122-
}, {});
131+
});
123132
assert(result.row);
124133
assert(result.row.user_id && typeof result.row.user_id === 'string');
125134
assert(result.row.password === '3');

0 commit comments

Comments
 (0)