GTPersistance
GTPersistance 是 iOS 基于SQLite的数据库封装, 根据CTPersistance修改,统一命名规范。
使用
CTPersistance 提供 CTPersistanceAsyncExecutor
执行异步工作。
read:
[[GTPersistanceAsyncExecutor sharedInstance] read:^{
NSInteger count = COUNT;
while (count --> 0) {
TestRecord *record = (TestRecord *)[self.testTable findWithPrimaryKey:@(count) error:NULL];
NSLog(@"%@", record.primaryKey);
}
}];
write:
[[GTPersistanceAsyncExecutor sharedInstance] write:^{
NSInteger count = COUNT;
while (count --> 0) {
NSNumber *primaryKey = [self.testTable insertValue:@"casa" forKey:@"name" error:NULL];
NSLog(@"%@", primaryKey);
}
}];
CRUD操作
Create : see here
Read : see here
Update : see here
Delete : see here
Upsert : see here
其他操作
Database Migration : see here
Index of Columns : see here
Transaction : see here
Change Key of Encryption : see here
安装
你可以在 Podfile 中加入下面一行代码来使用 GTPersistance
pod 'GTPersistance'
作者
liuxc123, [email protected]
声明
GTPersistance is available under the MIT license. See the LICENSE file for more info.