diff --git a/docs/docs/commands/generic/renamenx.md b/docs/docs/commands/generic/renamenx.md new file mode 100644 index 0000000..942945a --- /dev/null +++ b/docs/docs/commands/generic/renamenx.md @@ -0,0 +1,47 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# RENAMENX + +### Syntax +``` +RENAMENX key newkey +``` + +### Module +generic + +### Categories +fast +keyspace +write + +### Description +Renames the specified key with the new name only if the new name does not already exist. + +### Examples + + + + Rename the key `mykey` to `newkey`: + ```go + db, err := sugardb.NewSugarDB() + if err != nil { + log.Fatal(err) + } + err = db.RenameNX("mykey", "newkey") + ``` + + + Rename the key `mykey` to `newkey`: + ``` + > RENAMENX mykey newkey + ``` + +