Add Values¶
Description¶
This operation adds new elements to a set. Duplicate values are ignored.
Method¶
// Check a Single Value
[[[Backendless.shared hive:(NSString *)hiveName] setStore:(NSString *)keyName] addWithValue:(id)value responseHandler:^(NSInteger)responseHandler errorHandler:^(Fault *)errorHandler];
// Check Multiple Values
[[[Backendless.shared hive:(NSString *)hiveName] mapStore:(NSString *)keyName] addWithValues:(NSArray *)values responseHandler:^(NSInteger)responseHandler errorHandler:^(Fault *)errorHandler];
// Check a Single Value
Backendless.shared.hive(hiveName: String).setStore(keyName: String).add(value: Any, responseHandler: ((Int) -> Void)!, errorHandler: ((Fault) -> Void)!)
// Check Multiple Values
Backendless.shared.hive(hiveName: String).mapStore(keyName: String).add(values: [Any], 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 set. String value. |
value |
A value to add to the set. The value can be of any data type. |
values |
An array of values to add to the set. Values can be of any data type. |
Return Value¶
Number of elements added to the set.
Example¶
Add a Single Value
The example below adds a new value "SUV"
to the "cars"
set.
[[[Backendless.shared hive:@"transport"] setStore:@"cars"] addWithValue:@"SUV" responseHandler:^(NSInteger response) {
// handle response
} errorHandler:^(Fault *fault) {
// handle error
}];
Backendless.shared.hive("transport").setStore("cars").add(value: "SUV", responseHandler: { response in
// handle response
}, errorHandler: { fault in
// handle error
})
where:
Argument | Description |
---|---|
"transport" |
Name of a hive where the operation is performed. |
"cars" |
Key name identifying a set. |
Add Multiple Values
The example below adds new values "SUV"
and "Coupe"
to the "cars"
set.
[[[Backendless.shared hive:@"transport"] setStore:@"cars"] addWithValues:@[@"SUV", @"Coupe"] responseHandler:^(NSInteger response) {
// handle response
} errorHandler:^(Fault *fault) {
// handle error
}];
Backendless.shared.hive("transport").setStore("cars").add(values: ["SUV", "Coupe"], responseHandler: { response in
// handle response
}, errorHandler: { fault in
// handle error
})
where:
Argument | Description |
---|---|
"transport" |
Name of a hive where the operation is performed. |
"cars" |
Key name identifying a set. |
Codeless Reference¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a set. |
items |
A list of items to add to the set. |
Returns the number of elements added to the set.
Consider the following Set storage:
The example below adds "SUV"
and "Coupe"
to the "cars"
set:
The set will look as shown below after the Codeless logic runs: