@expo/knex-expo-sqlite-dialect
v0.0.1
Published
Knex.js dialect for Expo SQLite
Downloads
211
Readme
@expo/knex-expo-sqlite-dialect
Knex.js dialect for Expo SQLite
Installation
- Install the package
yarn add @expo/knex-expo-sqlite-dialect
- Add babel preset to the babel.config.js
--- a/babel.config.js
+++ b/babel.config.js
@@ -3,6 +3,7 @@ module.exports = function (api) {
return {
presets: [
'babel-preset-expo',
+ 'module:@expo/knex-expo-sqlite-dialect/babel-preset',
],
};
};
- Add the custom dialect for knex constructor
import ExpoSQLiteDialect from '@expo/knex-expo-sqlite-dialect';
import Knex from 'knex';
const knex = Knex({
client: ExpoSQLiteDialect,
connection: {
filename: 'MyDB.db',
},
});
Components
packages/knex-expo-sqlite-dialect
The main package
Since Knex.js is developed on Node.js runtime, some of Node.js dependencies are not available on React Native. The Babel preset uses the babel-plugin-module-resolver
plugin to alias these Node.js modules to other supported modules.
apps/example
The example app replicated from the with-sqlite
example with Knex.js integration.