mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-09-26 20:11:15 +08:00
Created documentation for RENAMENX command (#152)
* Created documentation for RENAMENX command - @DMcP89
This commit is contained in:
47
docs/docs/commands/generic/renamenx.md
Normal file
47
docs/docs/commands/generic/renamenx.md
Normal file
@@ -0,0 +1,47 @@
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# RENAMENX
|
||||
|
||||
### Syntax
|
||||
```
|
||||
RENAMENX key newkey
|
||||
```
|
||||
|
||||
### Module
|
||||
<span className="acl-category">generic</span>
|
||||
|
||||
### Categories
|
||||
<span className="acl-category">fast</span>
|
||||
<span className="acl-category">keyspace</span>
|
||||
<span className="acl-category">write</span>
|
||||
|
||||
### Description
|
||||
Renames the specified key with the new name only if the new name does not already exist.
|
||||
|
||||
### Examples
|
||||
|
||||
<Tabs
|
||||
defaultValue="go"
|
||||
values={[
|
||||
{ label: 'Go (Embedded)', value: 'go', },
|
||||
{ label: 'CLI', value: 'cli', },
|
||||
]}
|
||||
>
|
||||
<TabItem value="go">
|
||||
Rename the key `mykey` to `newkey`:
|
||||
```go
|
||||
db, err := sugardb.NewSugarDB()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = db.RenameNX("mykey", "newkey")
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="cli">
|
||||
Rename the key `mykey` to `newkey`:
|
||||
```
|
||||
> RENAMENX mykey newkey
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
Reference in New Issue
Block a user