UNPKG

react-native-nitro-sqlite

Version:

Fast SQLite library for React Native built using Nitro Modules

40 lines (39 loc) 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.close = close; exports.open = open; exports.openDb = openDb; var _nitro = require("../nitro.js"); var _transaction = require("./transaction.js"); var _execute = require("./execute.js"); var _executeBatch = require("./executeBatch.js"); function open(options) { openDb(options.name, options.location); return { close: () => close(options.name), delete: () => _nitro.HybridNitroSQLite.drop(options.name, options.location), attach: (dbNameToAttach, alias, location) => _nitro.HybridNitroSQLite.attach(options.name, dbNameToAttach, alias, location), detach: alias => _nitro.HybridNitroSQLite.detach(options.name, alias), transaction: fn => (0, _transaction.transaction)(options.name, fn), execute: (query, params) => (0, _execute.execute)(options.name, query, params), executeAsync: (query, params) => (0, _execute.executeAsync)(options.name, query, params), executeBatch: commands => (0, _executeBatch.executeBatch)(options.name, commands), executeBatchAsync: commands => (0, _executeBatch.executeBatchAsync)(options.name, commands), loadFile: location => _nitro.HybridNitroSQLite.loadFile(options.name, location), loadFileAsync: location => _nitro.HybridNitroSQLite.loadFileAsync(options.name, location) }; } function openDb(dbName, location) { _nitro.HybridNitroSQLite.open(dbName, location); _nitro.locks[dbName] = { queue: [], inProgress: false }; } function close(dbName) { _nitro.HybridNitroSQLite.close(dbName); delete _nitro.locks[dbName]; } //# sourceMappingURL=session.js.map