-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDBManager.h
More file actions
55 lines (41 loc) · 1.41 KB
/
DBManager.h
File metadata and controls
55 lines (41 loc) · 1.41 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// DBManager.h
// MackNotas
//
// Created by Caio Remedio on 23/07/15.
// Copyright (c) 2015 Caio Remedio. All rights reserved.
//
#import <YapDatabase/YapDatabase.h>
#import <YapDatabase/YapDatabaseConnection.h>
#import <YapDatabase/YapDatabaseView.h>
#import <YapDatabase/YapDatabaseFilteredView.h>
FOUNDATION_EXPORT NSString * const DBManagerWillUpdateNotification;
FOUNDATION_EXPORT NSString * const DBManagerDidUpdateNotification;
@protocol Persistable <NSObject>
- (NSString *)key;
+ (NSString *)collectionKey;
@optional
+ (void)registerViewsInDatabase:(YapDatabase *)database;
@end
@interface DBManager : NSObject
@property (nonatomic, readonly) YapDatabase *database;
@property (nonatomic, readonly) YapDatabaseConnection *uiConnection;
@property (nonatomic, readonly) YapDatabaseConnection *rwConnection;
/**
* gets singleton object.
* @return singleton
*/
+ (DBManager*)sharedInstance;
+ (void)clearAllData;
/**
* Verifica se há necessidade de uma request para atualizar a base local.
* É verificado a quantidade de items locais e o tempo desde a última atualização, respeitando o tempo estipulado de cache de cada model.
*
* @param model As subclasses @c MNModel
* @param mappings O mappings utilizado em cada tela
*
* @return @c YES se precisar, @c NO caso não.
*/
+ (BOOL)shouldUpdateModel:(NSString *)modelClass
withMappings:(YapDatabaseViewMappings *)mappings;
@end