@react-native-replicache/react-native-op-sqlite
Version:
> Plug-in React Native compatibility bindings for [Replicache](https://replicache.dev/).
21 lines • 852 B
JavaScript
import * as OPSQLite from "@op-engineering/op-sqlite";
import { getCreateReplicacheSQLiteKVStore, ReplicacheGenericSQLiteDatabaseManager } from "@react-native-replicache/replicache-generic-sqlite";
import { ReplicacheOPSQLiteTransaction } from "./replicache-op-sqlite-transaction";
const genericDatabase = {
open: async name => {
const db = OPSQLite.open({
name
});
return {
transaction: () => new ReplicacheOPSQLiteTransaction(db),
destroy: async () => db.delete(),
close: async () => db.close()
};
}
};
const opSqlManagerInstance = new ReplicacheGenericSQLiteDatabaseManager(genericDatabase);
export const createReplicacheReactNativeOPSQLiteKVStore = {
create: getCreateReplicacheSQLiteKVStore(opSqlManagerInstance),
drop: name => opSqlManagerInstance.destroy(name)
};
//# sourceMappingURL=index.js.map