-
Notifications
You must be signed in to change notification settings - Fork 0
Column Groups
cmancushman edited this page Oct 28, 2017
·
6 revisions
When an instance of StackBaseTable is created with the 'connectToStackBaseTableWithName:' method, it organizes its tables into groups:
-
allColumns-- every column the table contains. -
dateTypeColumns-- every date-time column the table contains. -
textTypeColumnss-- every text column the table contains. -
numericTypeColumns-- every numeric column the table contains.
The accessor methods StackBaseTable provides
Declarations
-(NSArray<StackBaseColumn *> *)allColumns;-(NSArray<NSString *> *)allColumnNames;Example
NSArray *allColumns = [weakSelf.table allColumns];Declarations
-(NSArray<StackBaseColumn *> *)dateTypeColumns;-(NSArray<NSString *> *)dateTypeColumnNames;Example
NSArray *dateTimeColumns = [weakSelf.table dateTypeColumns];Declarations
-(NSArray<StackBaseColumn *> *)textTypeColumns;-(NSArray<NSString *> *)textTypeColumnNames;Example
NSArray *textColumns = [weakSelf.table textTypeColumns];Declarations
-(NSArray<StackBaseColumn *> *)numericTypeColumns;-(NSArray<NSString *> *)numericTypeColumnNames;Example
NSArray *numericColumns = [weakSelf.table numericTypeColumns];Declarations
-(BOOL)columnExistsWithName:(NSString *)name;Example
if([weakSelf.table columnExistsWithName:@"Name"]){
NSLog(@"Column Exists!");
}Column groups can help make running commands more intuitive. They can be passed as search parameters for queries, or removed all at the same time.
Examples
[weakSelf.table getFirst:3 rowsWhere:[StackBaseCondition columnsWithNames:[weakSelf.table textTypeColumnNames] matchPhrase:@"donut"] completionBlock:^(BOOL success, NSString *responseMessage, NSArray<NSDictionary *> *responseTable) {
for(NSDictionary *row in responseTable){
NSLog(@"row %ld: %@", ([responseTable indexOfObject:row] + 1), row);
}
}];[weakSelf.table removeColumns:[weakSelf.table numericTypeColumns] completionBlock:^(BOOL success, NSString *responseMessage) {
if(success){
NSLog(@"Operation Successful.");
}else{
NSLog(@"Operation Unsuccessful: %@", responseMessage);
}
}];Intro
Managing Tables
Managing Columns
Managing Rows
Conditions
Going Forward