mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +00:00
Add support for ReJSON-RL commands and JSON data type in Redis driver
This commit is contained in:
@@ -451,6 +451,14 @@ const driver = {
|
||||
case 'string':
|
||||
res.value = await dbhan.client.get(key);
|
||||
break;
|
||||
case 'ReJSON-RL':
|
||||
res.type = 'json';
|
||||
try {
|
||||
res.value = JSON.stringify(await dbhan.client.call('JSON.GET', key), null, 2);
|
||||
} catch (e) {
|
||||
res.value = '';
|
||||
}
|
||||
break;
|
||||
// case 'list':
|
||||
// res.tableColumns = [{ name: 'value' }];
|
||||
// res.addMethod = 'rpush';
|
||||
@@ -489,6 +497,8 @@ const driver = {
|
||||
return await this.deleteBranch(dbhan, args[0]);
|
||||
case 'zadd':
|
||||
return await dbhan.client.zadd(args[0], args[2], args[1]);
|
||||
case 'json.set':
|
||||
return await dbhan.client.call('JSON.SET', args[0], '$', args[1]);
|
||||
case 'xaddjson':
|
||||
let json;
|
||||
try {
|
||||
|
||||
@@ -76,6 +76,12 @@ const driver = {
|
||||
addMethod: 'xaddjson',
|
||||
showItemList: true,
|
||||
},
|
||||
{
|
||||
name: 'json',
|
||||
label: 'JSON',
|
||||
dbKeyFields: [{ name: 'value' }],
|
||||
addMethod: 'json.set',
|
||||
}
|
||||
],
|
||||
|
||||
showConnectionField: (field, values) => {
|
||||
|
||||
Reference in New Issue
Block a user