Skip to content

shinrenpan/SRPPlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SRPPlist

Carthage compatible

Plist as database.

注意事項

  1. Not thread safe.
  2. 只接受 plist 可儲存的格式:
    • NSString
    • NSNumber
    • NSArray
    • NSDictionary
    • NSDate
    • NSData

安裝

使用 Carthage 安裝.

使用

查詢

+ (nullable NSArray <NSDictionary *> *)plist:(NSString *)name
                                  queryWhere:(nullable NSPredicate *)where
                                     orderBy:(nullable NSArray <NSSortDescriptor *> *)orders;

其中

  • name: plist 名稱.
  • where: 過濾條件.
  • orders: 排序條件.

where == nil 時, 將返回全部查詢.

新增

+ (BOOL)plist:(NSString *)name insert:(NSArray <NSDictionary *> *)dics;

其中

  • name: plist 名稱.
  • dics: 要新增的資料, 單筆或多筆.

修改

+ (BOOL)plist:(NSString *)name update:(NSDictionary *)dic where:(NSPredicate *)where;

其中

  • name: plist 名稱.
  • dic: 要修改的資料.
  • where: 過濾條件.

where 不成立 將返回修改失敗.

刪除

+ (BOOL)plist:(NSString *)name removeWhere:(NSPredicate *)where;

其中

  • name: plist 名稱.
  • where: 過濾條件.

where 不成立 將返回刪除失敗.

移除 Plist

+ (BOOL)dropPlist:(NSString *)name;

其中

  • name: plsit 名稱.

可用來刪除全部資料.