-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathNSManagedObjectContext+Additions.h
48 lines (38 loc) · 2.62 KB
/
NSManagedObjectContext+Additions.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
//
// NSManagedObjectContext+Additions.h
//
// Created by Wess Cope on 9/23/11.
// Copyright 2012. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "NSFetchRequest+Additions.h"
typedef void (^ContextCallback)(NSManagedObjectContext *context);
typedef void (^ContextObjectCallback)(NSManagedObjectContext *context, id object);
typedef void (^ContextObjectsCallback)(NSManagedObjectContext *context, NSArray *objects);
@interface NSManagedObjectContext(Additions)
#pragma mark - Conveince Property
@property (nonatomic, readonly) NSManagedObjectModel *objectModel;
#pragma mark - Sync methods
- (NSArray *)fetchObjectsForEntity:(NSString *)entity;
- (NSArray *)fetchObjectsForEntity:(NSString *)entity predicate:(NSPredicate *)predicate;
- (NSArray *)fetchObjectsForEntity:(NSString *)entity sortDescriptors:(NSArray *)sortDescriptors;
- (NSArray *)fetchObjectsForEntity:(NSString *)entity predicate:(NSPredicate *)predicate sortDescriptors:(NSArray *)sortDescriptors;
- (id)fetchObjectForEntity:(NSString *)entity;
- (id)fetchObjectForEntity:(NSString *)entity predicate:(NSPredicate *)predicate;
- (id)fetchObjectForEntity:(NSString *)entity sortDescriptors:(NSArray *)sortDescriptors;
- (id)fetchObjectForEntity:(NSString *)entity predicate:(NSPredicate *)predicate sortDescriptors:(NSArray *)sortDescriptors;
#pragma mark - Async Methods
- (void)fetchObjectsForEntity:(NSString *)entity callback:(FetchObjectsCallback)callback;
- (void)fetchObjectsForEntity:(NSString *)entity predicate:(NSPredicate *)predicate callback:(FetchObjectsCallback)callback;
- (void)fetchObjectsForEntity:(NSString *)entity sortDescriptors:(NSArray *)sortDescriptors callback:(FetchObjectsCallback)callback;
- (void)fetchObjectsForEntity:(NSString *)entity predicate:(NSPredicate *)predicate sortDescriptors:(NSArray *)sortDescriptors callback:(FetchObjectsCallback)callback;
- (void)fetchObjectForEntity:(NSString *)entity callback:(FetchObjectCallback)callback;
- (void)fetchObjectForEntity:(NSString *)entity predicate:(NSPredicate *)predicate callback:(FetchObjectCallback)callback;
- (void)fetchObjectForEntity:(NSString *)entity sortDescriptors:(NSArray *)sortDescriptors callback:(FetchObjectCallback)callback;
- (void)fetchObjectForEntity:(NSString *)entity predicate:(NSPredicate *)predicate sortDescriptors:(NSArray *)sortDescriptors callback:(FetchObjectCallback)callback;
- (void)fetchRequest:(NSFetchRequest *)fetchRequest withCallback:(FetchObjectsCallback)callback;
#pragma mark - Insert New Entity
- (id)insertEntity:(NSString *)entity;
- (void)deleteEntity:(NSString *)entity withPredicate:(NSPredicate *)predicate;
@end