Implement DBSIZE command (#159)

Implement DBSIZE Command - @NicoleStrel
This commit is contained in:
Nicole Streltsov
2025-01-06 05:40:40 -05:00
committed by GitHub
parent 108bf97b4d
commit 8f1330e326
11 changed files with 2158 additions and 3903 deletions

View File

@@ -0,0 +1,47 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# DBSIZE
### Syntax
```
DBSIZE
```
### Module
<span className="acl-category">generic</span>
### Categories
<span className="acl-category">fast</span>
<span className="acl-category">read</span>
<span className="acl-category">keyspace</span>
### Description
Return the number of keys in the currently-selected database.
### Examples
<Tabs
defaultValue="go"
values={[
{ label: 'Go (Embedded)', value: 'go', },
{ label: 'CLI', value: 'cli', },
]}
>
<TabItem value="go">
Get the number of keys in the database:
```go
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
key, err := db.DBSize()
```
</TabItem>
<TabItem value="cli">
Get the number of keys in the database:
```
> DBSIZE
```
</TabItem>
</Tabs>