mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 19:13:59 +00:00
redis key sizes
This commit is contained in:
@@ -48,8 +48,16 @@
|
|||||||
title={item.text}
|
title={item.text}
|
||||||
expandIcon={item.type == 'dir' ? plusExpandIcon(isExpanded) : 'icon invisible-box'}
|
expandIcon={item.type == 'dir' ? plusExpandIcon(isExpanded) : 'icon invisible-box'}
|
||||||
on:expand={() => {
|
on:expand={() => {
|
||||||
isExpanded = !isExpanded;
|
if (item.type == 'dir') {
|
||||||
|
isExpanded = !isExpanded;
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
|
on:click={() => {
|
||||||
|
if (item.type == 'dir') {
|
||||||
|
isExpanded = !isExpanded;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
extInfo={item.count ? `(${item.count})` : null}
|
||||||
{indentLevel}
|
{indentLevel}
|
||||||
/>
|
/>
|
||||||
<!-- <div on:click={() => (isExpanded = !isExpanded)}>
|
<!-- <div on:click={() => (isExpanded = !isExpanded)}>
|
||||||
|
|||||||
@@ -93,17 +93,24 @@ const driver = {
|
|||||||
if (!key.startsWith(prefix)) continue;
|
if (!key.startsWith(prefix)) continue;
|
||||||
const keySplit = key.split(':');
|
const keySplit = key.split(':');
|
||||||
if (keySplit.length > rootSplit.length) {
|
if (keySplit.length > rootSplit.length) {
|
||||||
|
const text = keySplit[rootSplit.length];
|
||||||
if (keySplit.length == rootSplit.length + 1) {
|
if (keySplit.length == rootSplit.length + 1) {
|
||||||
res[keySplit[rootSplit.length]] = {
|
res[text] = {
|
||||||
text: keySplit[rootSplit.length],
|
text,
|
||||||
key,
|
key,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
res[keySplit[rootSplit.length]] = {
|
const dctKey = '::' + text;
|
||||||
text: keySplit[rootSplit.length],
|
if (res[dctKey]) {
|
||||||
type: 'dir',
|
res[dctKey].count++;
|
||||||
root: keySplit.slice(0, rootSplit.length + 1).join(':'),
|
} else {
|
||||||
};
|
res[dctKey] = {
|
||||||
|
text: text + ':*',
|
||||||
|
type: 'dir',
|
||||||
|
root: keySplit.slice(0, rootSplit.length + 1).join(':'),
|
||||||
|
count: 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,8 +118,21 @@ const driver = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async enrichOneKeyInfo(pool, item) {
|
async enrichOneKeyInfo(pool, item) {
|
||||||
const type = await pool.type(item.key);
|
item.type = await pool.type(item.key);
|
||||||
item.type = type;
|
switch (item.type) {
|
||||||
|
case 'list':
|
||||||
|
item.count = await pool.llen(item.key);
|
||||||
|
break;
|
||||||
|
case 'set':
|
||||||
|
item.count = await pool.scard(item.key);
|
||||||
|
break;
|
||||||
|
case 'zset':
|
||||||
|
item.count = await pool.zcard(item.key);
|
||||||
|
break;
|
||||||
|
case 'stream':
|
||||||
|
item.count = await pool.xlen(item.key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async enrichKeyInfo(pool, levelInfo) {
|
async enrichKeyInfo(pool, levelInfo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user