mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-09-27 04:16:06 +08:00
Implement DBSIZE command (#159)
Implement DBSIZE Command - @NicoleStrel
This commit is contained in:
47
docs/docs/commands/generic/dbsize.mdx
Normal file
47
docs/docs/commands/generic/dbsize.mdx
Normal 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>
|
Reference in New Issue
Block a user