Increment¶
Description¶
This operation increments the key's value by a specific number.
Method¶
[[[Backendless.shared hive:(NSString *)hiveName] keyValueStore:(NSString *)keyName] incrementWithValue:(NSInteger)value responseHandler:^(NSInteger)responseHandler errorHandler:^(Fault *)errorHandler];
Backendless.shared.hive(hiveName: String).keyValueStore(keyName: String).increment(value: Int, responseHandler: ((Int) -> Void)!, errorHandler: ((Fault) -> Void)!)
where:
Argument | Description |
---|---|
hiveName |
Name of a hive where the operation is performed. String value. |
keyName |
Key name identifying a key-value pair. String value. |
value |
A number to increment the value of the key. |
Return Value¶
Тhe incremented value.
Example¶
The example below increments the value associated with the key "John"
by 2
.
[[[Backendless.shared hive:@"workedHours"] keyValueStore:@"John"] incrementWithValue:2 responseHandler:^(NSInteger response) {
// handle response
} errorHandler:^(Fault *fault) {
// handle error
}];
Backendless.shared.hive("workedHours").keyValueStore("John").increment(value: 2, responseHandler: { response in
// handle response
}, errorHandler: { fault in
// handle error
})
where:
Argument | Description |
---|---|
"workedHours" |
Name of a hive where the operation is performed. |
"John" |
Key name to increment the associated value by 2 . |
Codeless Reference¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a key-value pair. |
increment by |
Specify a number to increment the value by. |
Returns the incremented value.
Consider the following Key Value storage:
The example below increments the value for the "Apples"
key by 2
:
The key-value storage will look as shown below after the Codeless logic runs: