UNPKG

@journeyapps/react-native-quick-sqlite

Version:
54 lines (53 loc) 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setupTypeORMDriver = void 0; /** * DO NOT USE THIS! THIS IS MEANT FOR TYPEORM * If you are looking for a convenience wrapper use `connect` */ const setupTypeORMDriver = open => ({ openDatabase: (options, ok, fail) => { try { const _con = open(options.name, { location: options.location }); const connection = { executeSql: async (sql, params, ok, fail) => { try { let response = await _con.execute(sql, params); ok(response); } catch (e) { fail(e); } }, transaction: fn => { return _con.writeTransaction(fn); }, close: (ok, fail) => { try { _con.close(); ok(); } catch (e) { fail(e); } }, attach: (dbNameToAttach, alias, location, callback) => { _con.attach(dbNameToAttach, alias, location); callback(); }, detach: (alias, callback) => { _con.detach(alias); callback(); } }; ok(connection); return connection; } catch (e) { fail(e); } } }); exports.setupTypeORMDriver = setupTypeORMDriver; //# sourceMappingURL=type-orm.js.map