-
Notifications
You must be signed in to change notification settings - Fork 614
/
Copy pathDatabasePlatform.h
41 lines (29 loc) · 1.09 KB
/
DatabasePlatform.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
#pragma once
#include <functional>
#include <string>
#include "Database.h"
namespace watermelondb {
namespace platform {
// Logs to console
void consoleLog(std::string message);
// Logs error to console
void consoleError(std::string message);
// Called before a Sqlite object is constructed
// Use to initialize sqlite, if necessary
void initializeSqlite();
// Given a database name, returns a fully-qualified default database path
// e.g. /Users/foo.app/<name>.db
std::string resolveDatabasePath(std::string path);
// Removes database file located at `path`.
// Throws an exception if it's not possible to delete this file
void deleteDatabaseFile(std::string path, bool warnIfDoesNotExist);
// Calls function when device memory is getting low
void onMemoryAlert(std::function<void(void)> callback);
// Returns sync json provided by the user
std::string_view getSyncJson(int id);
// Destroys sync json after it's used
void deleteSyncJson(int id);
// Called when React Native bridge is being torn down
void onDestroy(std::function<void(void)> callback);
} // namespace platform
} // namespace watermelondb