Making typeorm use react-native-sqlite-2 on React Native to use JSON1

540 Views Asked by At

I'm currently using typeorm with react-native. In order to work on this environment, typeorm use react-native-sqlite-storage internally. But this library use the standard SQLite database on Android that not support JSON1 module (I absolutelly need to use json_extract in some request).

I know the npm package react-native-sqlite-2 can be used to have access to JSON1 but this seems not compatible with typeorm and so require to open another connection for doing just few request, which is not very convenient.

Is someone have an idea to make typeorm use react-native-sqlite-2 instead (I'm ready to fork the library if need but I really don't know where I should edit this behavior).

Thanks.

1

There are 1 best solutions below

0
On

I finally find a way to use JSON1 with typeorm. This is more easier that I think, we can do this by using react-native-sqlite-storage. As the readme say, we can edit our react-native.config.js to use the sqlite bundle that is bring with the lib. It's look like this bundle work with JSON1.