FLEXSQLResult.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // FLEXSQLResult.h
  3. // FLEX
  4. //
  5. // Created by Tanner on 3/3/20.
  6. // Copyright © 2020 Flipboard. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @interface FLEXSQLResult : NSObject
  11. /// Describes the result of a non-select query, or an error of any kind of query
  12. + (instancetype)message:(NSString *)message;
  13. /// @param rowData A list of rows, where each element in the row
  14. /// corresponds to the column given in /c columnNames
  15. + (instancetype)columns:(NSArray<NSString *> *)columnNames
  16. rows:(NSArray<NSArray<NSString *> *> *)rowData;
  17. @property (nonatomic, readonly, nullable) NSString *message;
  18. /// A list of column names
  19. @property (nonatomic, readonly, nullable) NSArray<NSString *> *columns;
  20. /// A list of rows, where each element in the row corresponds
  21. /// to the value of the column at the same index in \c columns.
  22. ///
  23. /// That is, given a row, looping over the contents of the row and
  24. /// the contents of \c columns will give you key-value pairs of
  25. /// column names to column values for that row.
  26. @property (nonatomic, readonly, nullable) NSArray<NSArray<NSString *> *> *rows;
  27. /// A list of rows where the fields are paired to column names.
  28. ///
  29. /// This property is lazily constructed by looping over
  30. /// the rows and columns present in the other two properties.
  31. @property (nonatomic, readonly, nullable) NSArray<NSDictionary<NSString *, id> *> *keyedRows;
  32. @end
  33. NS_ASSUME_NONNULL_END