Get Specific Key-Values¶
Description¶
This operation retrieves specific key-value pairs from a map.
Method¶
[[[Backendless.shared hive:(NSString *)hiveName] mapStore:(NSString *)keyName] getWithKeys:(NSArray<NSString *> *)keys responseHandler:^(NSDictionary<NSString *,id> *)responseHandler errorHandler:^(Fault *)errorHandler];
Backendless.shared.hive(hiveName: String).mapStore(keyName: String).get(keys: [String], responseHandler: (([String : Any]) -> 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. |
keys |
An array of string values, where each value represents a key name identifying a key-value pair. |
Return Value¶
An object containing key-value pairs retrieved from the map. Returns an empty object if the specified keys do not exist.
Example¶
The example below retrieves key-value pairs specified by key names: "Oranges"
and "Apples"
from the "fruits"
map.
[[[Backendless.shared hive:@"groceryStore"] mapStore:@"fruits"] getWithKeys:@[@"Oranges", @"Apples"] responseHandler:^(NSDictionary *response) {
// handle response
} errorHandler:^(Fault *fault) {
// handle error
}];
Backendless.shared.hive("groceryStore").mapStore("fruits").get(keys: ["Oranges", "Apples"], 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. |
Response Example
{
"Oranges": 0.99,
"Apples": 1.19
}
Codeless Reference¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a map. |
object keys |
A list of key names identifying key-value pairs. |
Returns an object containing key-value pairs retrieved from the map.
Consider the following Map storage:
The example below retrieves two key-value pairs for the "Oranges"
and "Apples"
keys from the "fruits"
map.
The logic produces the following output: