Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jwallet/expo-sqlite-storage
React Native Expo SQLite module updated to support JSON extension using requery.sqlite-android library. Compatible with RxDB Premium
https://github.com/jwallet/expo-sqlite-storage
expo json rxdb sqlite websql
Last synced: 3 months ago
JSON representation
React Native Expo SQLite module updated to support JSON extension using requery.sqlite-android library. Compatible with RxDB Premium
- Host: GitHub
- URL: https://github.com/jwallet/expo-sqlite-storage
- Owner: jwallet
- License: mit
- Created: 2023-03-10T13:06:40.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-22T01:27:35.000Z (about 1 year ago)
- Last Synced: 2024-04-24T14:20:21.224Z (10 months ago)
- Topics: expo, json, rxdb, sqlite, websql
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/expo-sqlite-storage
- Size: 1.67 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# Expo SQLite Storage
[](#)
[](#)
[](#)
[](#)
[](#)
[](https://github.com/expo/expo/tree/main/packages/expo-sqlite)
[](https://github.com/requery/sqlite-android)> [!IMPORTANT]
> This package will become useless once Expo SDK 50 is released.
> The new SDK introduces changes to their official `expo-sqlite` and they upgraded to a more recent SQLite version that will support JSON function such as `json_extract`.Implements the original [expo-sqlite](https://github.com/expo/expo/tree/main/packages/expo-sqlite) with an updated version of android.database.sqlite from [requery.sqlite-android](https://github.com/requery/sqlite-android) which adds support for:
- JSON1 extension
- Common Table expressions
- Indexes on expressions
- Full Text Search 5
- Generated Columns
- DROP COLUMN supportThis cannot be used in Expo GO, see the related [error](#error) section.
### RxDB Premium compatible
It's compatible with [RxDB](https://github.com/pubkey/rxdb) Premium [SQLite](https://rxdb.info/rx-storage-sqlite.html) storage:
```js
import {
getRxStorageSQLite,
getSQLiteBasicsExpoSQLite,
} from "rxdb-premium/plugins/storage-sqlite";
import * as ExpoSqliteStorage from "expo-sqlite-storage";
import { createRxDatabase } from "rxdb";const storage = getRxStorageSQLite({
sqliteBasics: getSQLiteBasicsExpoSQLite(ExpoSqliteStorage.openDatabase),
});const db = await createRxDatabase({
name: storage.name,
storage,
multiInstance: false,
ignoreDuplicate: true,
});
```| iOS | Android |
| :--------------------------------------------------- | :------------------------------------------------------- |
||
|
# Installation in managed Expo project
### Add the package to your npm dependencies
```
npm install expo-sqlite-storage
```or
```
yarn add expo-sqlite-storage
```build your native apps
```
npx expo run:android|ios
```run only the app
```
npx expo start --dev-client
```## Error
#### {"name":"TypeError","message":"null is not an object (evaluating 'SQLiteDatabase.exec')
Will not work inside **Expo GO** until the Expo team [updates their SQLite database](https://expo.canny.io/feature-requests/p/expo-sqlite-ship-newer-sqlite3-version-on-android) to a more recent version.
# Installation in bare React Native projects
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
### Add the package to your npm dependencies
```
npm install expo-sqlite-storage
```or
```
yarn add expo-sqlite-storage
```### Configure for iOS
React-Native above 0.60:
Run `npx pod-install` after installing the npm package.
### Configure for Android