Skip to content

Commit 2a70310

Browse files
author
Oscar Franco
committed
Update readme
1 parent 0a9a12f commit 2a70310

4 files changed

Lines changed: 147 additions & 3419 deletions

File tree

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,10 @@ JSI bindings are fast but there is still some overhead calling `executeSql` for
182182

183183
```typescript
184184
QuickSQLite.transaction('myDatabase', (tx) => {
185-
const {
186-
status,
187-
} = tx.executeSql('UPDATE sometable SET somecolumn = ? where somekey = ?', [
188-
0,
189-
1,
190-
]);
185+
const { status } = tx.executeSql(
186+
'UPDATE sometable SET somecolumn = ? where somekey = ?',
187+
[0, 1]
188+
);
191189

192190
if (status) {
193191
return false;
@@ -308,7 +306,20 @@ On Android unfortunately it is not possible to link from C++ to the phone's embe
308306

309307
## Use TypeORM
310308

311-
You can use this driver with [TypeORM](https://github.com/typeorm/typeorm) and [patch-package](https://github.com/ds300/patch-package) by the default react-native-sqlite-storage driver. Go inside your `node_modules/typeorm` and do a global replace of `react-native-sqlite-storage` for `react-native-quick-sqlite` and then patch package it. The [patch](https://github.com/ospfranco/react-native-quick-sqlite/blob/main/example/patches/typeorm%2B0.2.36.patch) on the example folder you will see an example of what it should look like
309+
You can use this driver with [TypeORM](https://github.com/typeorm/typeorm), when initializing the connection use:
310+
311+
```ts
312+
datasource = new DataSource({
313+
type: 'react-native',
314+
database: 'typeormdb',
315+
location: '.',
316+
driver: require('react-native-quick-sqlite'),
317+
entities: [Book, User],
318+
synchronize: true,
319+
});
320+
```
321+
322+
If you are using Node 14+, TypeORM is currently broken with React Native. You can patch your node-modules installation and apply the fix [in this issue](https://github.com/typeorm/typeorm/issues/9178).
312323

313324
## More
314325

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module.exports = {
33
plugins: [
44
'babel-plugin-transform-typescript-metadata',
55
['@babel/plugin-proposal-decorators', { legacy: true }],
6-
// ["@babel/plugin-proposal-class-properties", { "loose" : true }]
6+
["@babel/plugin-proposal-class-properties", { "loose" : true }]
77
],
88
};

package.json

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"scripts": {
2626
"test": "jest",
2727
"typescript": "tsc --noEmit",
28-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
2928
"prepare": "bob build",
3029
"release": "release-it",
3130
"example": "yarn --cwd example",
@@ -49,21 +48,12 @@
4948
"registry": "https://registry.npmjs.org/"
5049
},
5150
"devDependencies": {
52-
"@commitlint/config-conventional": "^15.0.0",
53-
"@react-native-community/eslint-config": "^3.0.1",
54-
"@release-it/conventional-changelog": "^3.3.0",
5551
"@types/jest": "^26.0.0",
5652
"@types/react": "17.0.2",
57-
"@types/react-native": "0.67.2",
58-
"commitlint": "^11.0.0",
59-
"eslint": "^7.32.0",
60-
"eslint-config-prettier": "^7.2.0",
61-
"eslint-plugin-prettier": "^4.0.0",
53+
"@types/react-native": "0.67.4",
6254
"husky": "^6.0.0",
63-
"jest": "^26.0.1",
64-
"pod-install": "^0.1.32",
6555
"react": "17.0.2",
66-
"react-native": "0.67.3",
56+
"react-native": "0.67.4",
6757
"react-native-builder-bob": "^0.18.2",
6858
"release-it": "^14.2.2",
6959
"typescript": "^4.5.2"
@@ -72,13 +62,6 @@
7262
"react": "*",
7363
"react-native": "*"
7464
},
75-
"jest": {
76-
"preset": "react-native",
77-
"modulePathIgnorePatterns": [
78-
"<rootDir>/example/node_modules",
79-
"<rootDir>/lib/"
80-
]
81-
},
8265
"release-it": {
8366
"git": {
8467
"commitMessage": "chore: release ${version}",
@@ -96,29 +79,6 @@
9679
}
9780
}
9881
},
99-
"eslintConfig": {
100-
"root": true,
101-
"extends": [
102-
"@react-native-community",
103-
"prettier"
104-
],
105-
"rules": {
106-
"prettier/prettier": [
107-
"error",
108-
{
109-
"quoteProps": "consistent",
110-
"singleQuote": true,
111-
"tabWidth": 2,
112-
"trailingComma": "es5",
113-
"useTabs": false
114-
}
115-
]
116-
}
117-
},
118-
"eslintIgnore": [
119-
"node_modules/",
120-
"lib/"
121-
],
12282
"prettier": {
12383
"quoteProps": "consistent",
12484
"singleQuote": true,

0 commit comments

Comments
 (0)