mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-05 16:06:57 +08:00
Added godoc comment for Decr embedded API method.
This commit is contained in:
@@ -440,6 +440,14 @@ func (server *EchoVault) Incr(key string) (int, error) {
|
|||||||
return internal.ParseIntegerResponse(b)
|
return internal.ParseIntegerResponse(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Decr decrements the value at the given key if it's an integer.
|
||||||
|
// If the key does not exist, it's created with an initial value of 0 before incrementing.
|
||||||
|
//
|
||||||
|
// Parameters:
|
||||||
|
//
|
||||||
|
// `key` - string
|
||||||
|
//
|
||||||
|
// Returns: The new value as an integer.
|
||||||
func (server *EchoVault) Decr(key string) (int, error) {
|
func (server *EchoVault) Decr(key string) (int, error) {
|
||||||
// Construct the command
|
// Construct the command
|
||||||
cmd := []string{"DECR", key}
|
cmd := []string{"DECR", key}
|
||||||
|
@@ -649,7 +649,10 @@ LT - Only set the expiry time if the new expiry time is less than the current on
|
|||||||
Command: "incr",
|
Command: "incr",
|
||||||
Module: constants.GenericModule,
|
Module: constants.GenericModule,
|
||||||
Categories: []string{constants.KeyspaceCategory, constants.WriteCategory, constants.FastCategory},
|
Categories: []string{constants.KeyspaceCategory, constants.WriteCategory, constants.FastCategory},
|
||||||
Description: `(INCR key) Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that cannot be represented as integer. This operation is limited to 64 bit signed integers.`,
|
Description: `(INCR key)
|
||||||
|
Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation.
|
||||||
|
An error is returned if the key contains a value of the wrong type or contains a string that cannot be represented as integer.
|
||||||
|
This operation is limited to 64 bit signed integers.`,
|
||||||
Sync: true,
|
Sync: true,
|
||||||
KeyExtractionFunc: incrKeyFunc,
|
KeyExtractionFunc: incrKeyFunc,
|
||||||
HandlerFunc: handleIncr,
|
HandlerFunc: handleIncr,
|
||||||
@@ -658,7 +661,11 @@ LT - Only set the expiry time if the new expiry time is less than the current on
|
|||||||
Command: "decr",
|
Command: "decr",
|
||||||
Module: constants.GenericModule,
|
Module: constants.GenericModule,
|
||||||
Categories: []string{constants.KeyspaceCategory, constants.WriteCategory, constants.FastCategory},
|
Categories: []string{constants.KeyspaceCategory, constants.WriteCategory, constants.FastCategory},
|
||||||
Description: `(DECR key) Decrements the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that cannot be represented as integer. This operation is limited to 64 bit signed integers.`,
|
Description: `(DECR key)
|
||||||
|
Decrements the number stored at key by one.
|
||||||
|
If the key does not exist, it is set to 0 before performing the operation.
|
||||||
|
An error is returned if the key contains a value of the wrong type or contains a string that cannot be represented as integer.
|
||||||
|
This operation is limited to 64 bit signed integers.`,
|
||||||
Sync: true,
|
Sync: true,
|
||||||
KeyExtractionFunc: decrKeyFunc,
|
KeyExtractionFunc: decrKeyFunc,
|
||||||
HandlerFunc: handleDecr,
|
HandlerFunc: handleDecr,
|
||||||
|
Reference in New Issue
Block a user