Check If Exists¶
Description¶
This operation verifies if a specific key exists in the specified map.
Method¶
[[[Backendless.shared hive:(NSString *)hiveName] mapStore:(NSString *)keyName] keyExistsWithKey:(NSString *)key responseHandler:^(BOOL)responseHandler errorHandler:^(Fault *)errorHandler];
Backendless.shared.hive(hiveName: String).mapStore(keyName: String).keyExists(key: String, responseHandler: ((Bool) -> Void)!, errorHandler: ((Fault) -> Void)!)
where:
Argument | Description |
---|---|
hiveName |
Name of a hive where the operation is performed. String value. |
keyName |
Key name identifying a map. String value. |
key |
Key name identifying a key-value pair to check if it exists. String value. |
Return Value¶
true
if an object exists. Otherwise, returns false
.
Example¶
The example below checks if the "Oranges"
key exists in the "fruits"
map.
[[[Backendless.shared hive:@"groceryStore"] mapStore:@"fruits"] keyExistsWithKey:@"Oranges" responseHandler:^(BOOL response) {
// handle response
} errorHandler:^(Fault *fault) {
// handle error
}];
Backendless.shared.hive("groceryStore").mapStore("fruits").keyExists(key: "Oranges", responseHandler: { response in
// handle response
}, errorHandler: { fault in
// handle error
})
where:
Argument | Description |
---|---|
"groceryStore" |
Name of a hive where the operation is performed. |
"fruits" |
Key name identifying a map. |
Codeless Reference
¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a map. |
object key name |
Key name identifying a key-value pair. |
Returns true
if an object exists. Otherwise, returns false
.
Consider the following Map storage:
The example below checks if a key-value pair with the key name "Oranges"
exists in the "fruits"
map.
The logic produces the following output: