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 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"
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" ,
Original file line number Diff line number Diff 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' ) ;
You can’t perform that action at this time.
0 commit comments