Move A Key (LCC.kvdb.dict.move_value)
Signature
ok, old_value_or_err = LCC.kvdb.dict.move_value(src_name, src_key, dst_name?, dst_key?, timeout?)
Parameters
- src_name
String. Source dictionary name (non-empty, max256bytes). - src_key
String. Source key (must be valid UTF-8 and non-empty). - dst_name
String, optional. Destination dictionary name, defaults to the source name (non-empty, max256bytes). - dst_key
String, optional. Destination key, defaults to the source key (must be valid UTF-8 and non-empty). - timeout
Number, optional. Request timeout in seconds, default60.
Returns
- ok
Boolean.trueon success,falseon failure. - old_value_or_err
String ornil. Previous value at the destination (ornilwhen absent); on failure it usually contains an error description, but missing source keys do not guarantee a fixed message.
Notes
Atomically transfers the key from the source dictionary to the destination.
When source and destination are identical, the function raises an error.
A successful move with no previous destination value yieldstrue, nil. Missing source keys returnfalse, and the second return value does not guarantee a fixed message.
Example
local ok, old = LCC.kvdb.dict.move_value("pending", "task#1", "running", "task#1")
if not ok then
error(old)
end