NSFetchRequest

NSFetchRequest即SQL的select操作。

Symbols

1 Managing the Fetch Request’s Entity

// 通过实体名初始化
@available(iOS 4.0, *)
public convenience init(entityName: String)
// 实体描述
open var entity: NSEntityDescription?
// 是否包含子实体的结果
@available(iOS 3.0, *)
open var includesSubentities: Bool

2 Fetch Constraints

// 谓词,即where
open var predicate: NSPredicate?
// 返回数据的上限
open var fetchLimit: Int
// 返回数据的偏移量,即跳过前面多少数据
@available(iOS 3.0, *)
open var fetchOffset: Int
// 分页获取
@available(iOS 3.0, *)
open var fetchBatchSize: Int
// 指定的持久化存储
open var affectedStores: [NSPersistentStore]?

3 Sorting

// 排序集合
open var sortDescriptors: [NSSortDescriptor]?

4 Prefetching

// 预获取关系数据
@available(iOS 3.0, *)
open var relationshipKeyPathsForPrefetching: [String]?

5 Managing How Results Are Returned

// 返回的类型
@available(iOS 3.0, *)
open var resultType: NSFetchRequestResultType
// 是否从内存中获取数据
@available(iOS 3.0, *)
open var includesPendingChanges: Bool
// 指定获取的属性
@available(iOS 3.0, *)
open var propertiesToFetch: [Any]?
// 是否去重
@available(iOS 3.0, *)
open var returnsDistinctResults: Bool
// 获取的数据是否缓存
@available(iOS 3.0, *)
open var includesPropertyValues: Bool
// 是否用获取的数据刷新当前缓存
@available(iOS 5.0, *)
open var shouldRefreshRefetchedObjects: Bool
// 返回的子实体是否加载到内存中
@available(iOS 3.0, *)
open var returnsObjectsAsFaults: Bool

6 Grouping and Filtering Dictionary Results

// GROUP BY操作
@available(iOS 5.0, *)
open var propertiesToGroupBy: [Any]?
// 分组
@available(iOS 5.0, *)
open var havingPredicate: NSPredicate?

7 Initializers

// 初始化
public init()

8 Instance Methods

// 提交请求
@available(iOS 10.0, *)
open func execute() throws -> [ResultType]

 


Appendix

NSFetchRequest

Revision History

时间描述
2016-10-26博文完成

CSDN:http://blog.csdn.net/y550918116j

GitHub:https://github.com/937447974

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值