GTPersistance
GTPersistance 是基于 SQLite 的 iOS 数据库封装,根据 CTPersistance 进行修改,统一了命名规范。
使用
CTPersistance 提供 CTPersistanceAsyncExecutor
来执行异步工作。
读取
[[GTPersistanceAsyncExecutor sharedInstance] read:^{
NSInteger count = COUNT;
while (count --> 0) {
TestRecord *record = (TestRecord *)[self.testTable findWithPrimaryKey:@(count) error:NULL];
NSLog(@"%@", record.primaryKey);
}
}];
写入
[[GTPersistanceAsyncExecutor sharedInstance] write:^{
NSInteger count = COUNT;
while (count --> 0) {
NSNumber *primaryKey = [self.testTable insertValue:@"casa" forKey:@"name" error:NULL];
NSLog(@"%@", primaryKey);
}
}];
CRUD 操作
Create : 查看这里
Read : 查看这里
Update : 查看这里
Delete : 查看这里
Upsert : 查看这里
其他操作
数据库迁移 : 查看这里
列索引 : 查看这里
事务 : 查看这里
更改加密密钥:请参阅这里 见此处
安装
你可以在 Podfile 中添加以下代码以使用 GTPersistance
pod 'GTPersistance'
作者
liuxc123,[email protected]
声明
GTPersistance 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。