-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuickFetch.h
More file actions
40 lines (30 loc) · 1.53 KB
/
QuickFetch.h
File metadata and controls
40 lines (30 loc) · 1.53 KB
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
/***********************************************************************************
** QuickFetch.h
** QuickFetch
**
** Created by Daniel Child on 3/20/09.
** Copyright 2009 EideticVisions LLC. All rights reserved.
**
** This is a simpler version of code I found on the web. I decided to remove
** the error checking and to return an array. It would also be better to set
** a second method that returns sorted items.
***********************************************************************************/
#import <Cocoa/Cocoa.h>
@interface NSManagedObjectContext (QuickFetch)
// returns the number of entities of a certain type
- (NSUInteger) quickCount: (NSString *) entityName;
// returns the number of entities of a certain type matching the predicate
- (NSUInteger) quickCount: (NSString *) entityName
withPredicate: (NSPredicate *) predicate;
// returns an array meeting the predicate criterion
- (NSArray *) quickFetch: (NSString *) entityName
withPredicate: (NSPredicate *) predicate;
// (returns all the objects having the type of entity
- (NSArray *) fetchAll: (NSString *) entityName;
// returns a sorted array meeting the predicate and sort criteria
- (NSArray *) quickFetch: (NSString *) entityName
withPredicate: (NSPredicate *) predicate
andSortDescriptor: (NSArray *) sortDescriptors; // SHOULD FIX THIS SO DON'T NEED TO PASS THE ARRAY, HANDLE ARRAY INTERNALLY TO METHOD
// deletes all the entities of a certain type
- (void) deleteAllObjectsOfType: (NSString *) entityName;
@end