File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " egg-mysql" ,
3
- "version" : " 4.0 .0" ,
3
+ "version" : " 4.1 .0" ,
4
4
"description" : " MySQL plugin for egg" ,
5
5
"eggPlugin" : {
6
6
"name" : " mysql"
20
20
" database"
21
21
],
22
22
"dependencies" : {
23
- "ali-rds" : " ^5.1.2 "
23
+ "ali-rds" : " ^6.4.0 "
24
24
},
25
25
"devDependencies" : {
26
26
"@eggjs/tsconfig" : " ^1.3.2" ,
Original file line number Diff line number Diff line change @@ -90,6 +90,15 @@ describe('test/mysql.test.ts', () => {
90
90
assert ( row . id === user . id ) ;
91
91
} ) ;
92
92
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
+
93
102
it ( 'should query one not exists return null' , async ( ) => {
94
103
let user = await app . mysql . queryOne ( 'select * from npm_auth where id = -1' ) ;
95
104
assert ( ! user ) ;
@@ -119,7 +128,7 @@ describe('test/mysql.test.ts', () => {
119
128
const result = await app . mysql . beginTransactionScope ( async conn => {
120
129
const row = await conn . queryOne ( 'select * from npm_auth order by id desc limit 10' ) ;
121
130
return { row } ;
122
- } , { } ) ;
131
+ } ) ;
123
132
assert ( result . row ) ;
124
133
assert ( result . row . user_id && typeof result . row . user_id === 'string' ) ;
125
134
assert ( result . row . password === '3' ) ;
You can’t perform that action at this time.
0 commit comments