-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathNSManagedObjectContextX.h
48 lines (37 loc) · 1.36 KB
/
NSManagedObjectContextX.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// NSManagedObjectContextX.h
//
// Copyright (c) 2014 Anthony Shoumikhin. All rights reserved under MIT license.
// mailto:[email protected]
//
#import <CoreData/CoreData.h>
@interface NSManagedObjectContext (X)
/**
Create a new object with entiry name.
@param name Entiry name of the object.
@return A new NSManagedObject.
*/
- (NSManagedObject *)newObjectOfEntity:(NSString *)name;
/**
Get an array of objects.
@param name Entiry name of the object.
@param predicate NSPredicate to fetch the objects.
@param sortDescriptors A list of sorting rules.
@param limit A fetch limit of objects to return. Zero means unlimited.
@return An array of fetched objects.
*/
- (NSArray *)objectsOfEntity:(NSString *)name withPredicate:(NSPredicate *)predicate sortDescriptors:(NSArray *)sortDescriptors andFetchLimit:(NSUInteger)limit;
/**
Delete several objects.
@param objects Objects to delete.
*/
- (void)deleteObjects:(NSArray *)objects;
/**
Delete several objects.
@param name Entiry name of the object.
@param predicate NSPredicate to fetch the objects to be removed.
@param sortDescriptors A list of sorting rules.
@param limit A fetch limit of objects to delete. Zero means unlimited.
*/
- (void)deleteObjectsOfEntity:(NSString *)name withPredicate:(NSPredicate *)predicate sortDescriptors:(NSArray *)sortDescriptors andFetchLimit:(NSUInteger)limit;
@end