#import <Foundation/Foundation.h>
#import "GYDBRunner.h"
@protocol GYModelObjectProtocol;
@interface GYDataContext : NSObject
+ (GYDataContext *)sharedInstance;
/**
*
* @param modelClass Class of the model object that you want to fetch.
* 需要查询的数据类型,在这里就是需要操作的数据表
* @param properties Properties you need. Pass nil to get values of all properties.
* 需要查询的表格中的字段,如果传入空的Array,返回所有的属性
* @param primaryKey Primary key value of the model object that you want to fetch.
* 需要查询的数据的主键
* @return Object that match the primary key value, or nil if none is found.
* 返回传入的表格的对象,对象内持有传入的字段的值
*/
- (id)getObject:(Class<GYModelObjectProtocol>)modelClass
properties:(NSArray *)properties
primaryKey:(id)primaryKey;
/**
*
* @param modelClass Class of the model objects that you want to fetch.
* 需要查询的数据类型,在这里就是需要操作的数据表
* @param properties Properties you need. Pass nil to get values of all properties.
* 需要查询的表格中的字段,如果传入空的Array,返回所有的属性
* @param where Where clause of SQL. Use '?'s as placeholders for arguments.
* 这里传入SQL语句,格式为“where........” 这里是SQL中的条件语句
* @param arguments Values to bind to the where clause.
* 上述SQL语句对应的Value
* @return Objects that match the condition of the where clause.
* 返回传入的表格的对象,对象内持有传入的字段的值
*/
- (NSArray *)getObjects:(Class<GYModelObjectProtocol>)modelClass
properties:(NSArray *)properties
where:(NSString *)where
arguments:(NSArray *)arguments;
/** Join two tables.
* 连标查询
* @param leftClass Class of the first join table.
* 第一个关联的表格,一般为父表
* @param leftProperties Properties of leftClass that you need. Pass nil to get values of all properties.
* 第一个表格的字段,一般为父表的字段,如果传入空的Array,返回所有的属性
* @param rightClass Class of the second join table.
* 关联的第二个表格,一般为子表
* @param rightProperties Properties of rightClass that you need. Pass nil to get values of all properties.
* 关联的字表的字段,一般为字表的字段, 如果传入空的Array,返回所有的属性
* @param joinType GYSQLJoinTypeInner, GYSQLJoinTypeLeft or GYSQLJoinTypeCross.
* 两个表关联的方式
* @param joinCondition Join condition. For example: 'leftTableName.property1 = rightTableName.property2'.
* 关联的字段
* @param where Where clause of SQL. Use '?'s as placeholders for arguments.
* 这里传入SQL语句,格式为“where........” 这里是SQL中的条件语句
* @param arguments Value