Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
e996e15
add yalc to gitignore
Sep 1, 2024
86bd024
add nitro-modules deps
Sep 1, 2024
397007c
add nitro.json
Sep 1, 2024
5302e24
implement nitro spec and restructure
Sep 1, 2024
bf79fd9
fix: nitro.json
Sep 1, 2024
2bc63f5
rename nitro spec interface
Sep 1, 2024
66c10da
first (partial) nitrogen specs
Sep 1, 2024
d37f1aa
full nitrogen specs (with string instead of any)
Sep 1, 2024
db3118c
more nitrogen files
Sep 1, 2024
a8c04f6
update nitrogen files
Sep 1, 2024
d7933a7
fix: naming clash
Sep 1, 2024
da4243c
remove generic parameter
Sep 1, 2024
b981870
add nitro-modules dep to example
Sep 1, 2024
301f7ae
chore: update ruby and gems
Sep 1, 2024
61012d4
update example Podfile
Sep 1, 2024
e904cec
fix: XCode 12 error
Sep 1, 2024
28f1a61
use extra SelectQueryResult HybridObject
Sep 1, 2024
053e016
fix: ios build
Sep 1, 2024
7729a54
implement first native hybrid function
Sep 2, 2024
de77eec
upgrade to RN 0.75.2
Sep 2, 2024
6b70ea7
disable typeORM stuff
Sep 2, 2024
06716a6
upgrade JDK version and gradle settings
Sep 2, 2024
d104b11
migrate codebase to RN0.75.2
Sep 2, 2024
0af5d40
remove yarn version dependency
Sep 2, 2024
e9238f4
update pods
Sep 2, 2024
ec78618
fix: TurboModule import
Sep 4, 2024
93588da
add more scripts
Sep 4, 2024
315dab1
load nitrogen in podspec
Sep 4, 2024
fe8200a
add Onload
Sep 4, 2024
ac03163
move specs
Sep 4, 2024
888820a
remove rn @types
Sep 4, 2024
1b229ac
fix lint
Sep 4, 2024
be94a8f
rename podspec
Sep 4, 2024
bf7ba4c
fix: ts
Sep 4, 2024
70cce45
fix: ts
Sep 4, 2024
638fb8e
remove unnecessary JSI files
Sep 5, 2024
71765f8
fix: CPP headers not found
Sep 5, 2024
8c32239
fix: onload and spec initialization
Sep 5, 2024
74a29bd
update specs
Sep 5, 2024
5078cfa
rename delete function
Sep 5, 2024
6a548da
fix: OnLoad and use generated specs
Sep 5, 2024
9a2585c
update generated files
Sep 5, 2024
3d75e25
rename internal delete function to drop to avoid keyword clash
Sep 5, 2024
0548315
update specs
Sep 6, 2024
cc4a75d
fix: specs
Sep 6, 2024
5f732ba
udpate specs
Sep 6, 2024
9ecfa76
implement nitro functions
Sep 6, 2024
84f8246
update specs
Sep 6, 2024
1e8b539
update specs
Sep 6, 2024
92bbe92
fix: wrong type
Sep 6, 2024
9b6fea8
updat ecpp
Sep 6, 2024
95e5e28
update specs
Sep 8, 2024
411c272
update specs
Sep 8, 2024
426eb3c
new implementation
Sep 8, 2024
8e7b407
update Podfile
Sep 8, 2024
855ab34
further implement nitro module
Sep 9, 2024
51d0064
update specs
Sep 9, 2024
bcc95f5
fix: inherit from abstract class
Sep 9, 2024
21c845e
fix: make iOS build
Sep 9, 2024
7a1dedd
fix: deps
Sep 9, 2024
a99f020
update specs
Sep 10, 2024
5e85ba7
update nitrogen files
Sep 10, 2024
fdf55de
rename type in C++
Sep 10, 2024
d37a717
disable tests temporarily
Sep 10, 2024
ff55b4b
update specs
Sep 10, 2024
7fe3b5a
restructure
Sep 10, 2024
3a563d1
update spec
Sep 10, 2024
18c9fa8
fix: ios build
Sep 10, 2024
c3b337a
update specs
Sep 11, 2024
26049df
change ColumnMetadata to TableMetadata
Sep 11, 2024
6eca091
add format-cpp script
Sep 11, 2024
f05b96f
re-structure JS code
Sep 11, 2024
f7d17e6
fix: tests
Sep 11, 2024
a8533d4
update specs
Sep 11, 2024
00fa0af
fix: simplify cpp and add ColumnMetadata hybrid object
Sep 11, 2024
c9152a5
add clang format script
Sep 11, 2024
4435d71
simplify spec
Sep 11, 2024
f4b0340
fix: spec update
Sep 11, 2024
d2d7d07
restructure types
Sep 11, 2024
464d71f
fix: missing return statement
Sep 11, 2024
993bcd5
enable new arch
Sep 11, 2024
2897ba8
fix: tests
Sep 11, 2024
761f7a4
update rn safe area context lib
Sep 11, 2024
4fd4b04
update nitro
Sep 11, 2024
8ed7787
add comment on how to get startup function in cpp
Sep 11, 2024
5ccd99f
add default hybrid object constructors
Sep 11, 2024
b83e43c
fix: HybridObject default constructor
Sep 11, 2024
14dc2d8
fix: import
Sep 11, 2024
b84413d
update nitro
chrispader Sep 13, 2024
307bb7c
add nitro autolinking
chrispader Sep 13, 2024
f05ed1f
re-structure javascript files
chrispader Sep 13, 2024
b51d7c2
fix: cpp
chrispader Sep 13, 2024
da62169
fix: ios
chrispader Sep 13, 2024
c94bae3
fix: bootup
chrispader Sep 13, 2024
76a9253
add clang-format config
chrispader Sep 13, 2024
c02e7d9
cpp format
chrispader Sep 13, 2024
4220e58
restructure cpp code
chrispader Sep 13, 2024
7fb39b2
update specs
chrispader Sep 13, 2024
dbb93f1
update spec
chrispader Sep 13, 2024
b9e48f8
update cpp
chrispader Sep 13, 2024
9041017
fix: cpp
chrispader Sep 13, 2024
78e91d3
improve exception handling
chrispader Sep 14, 2024
b85d6c1
rename
chrispader Sep 14, 2024
e33dfff
rename types
chrispader Sep 14, 2024
73a2e3f
fix: cpp
chrispader Sep 14, 2024
fc9b608
fix: user table type
chrispader Sep 14, 2024
1865c93
finish iOS
chrispader Sep 14, 2024
e48445e
remove console.log
chrispader Sep 15, 2024
9eac220
update bootstrap script
chrispader Sep 15, 2024
668e689
Merge branch 'main' into nitro
chrispader Sep 15, 2024
4cf29d1
fix: pods
chrispader Sep 15, 2024
1537ec9
Merge branch 'main' into nitro
chrispader Sep 15, 2024
e307a56
fix tests and typeORM and restructure js code
chrispader Sep 16, 2024
b955315
fix: tests
chrispader Sep 16, 2024
61dff0a
update specs
chrispader Sep 16, 2024
1f82195
Nitro migration for Android (#59)
chrispader Oct 2, 2024
8ed8af3
feat: add visionOS support (#53)
okwasniewski Sep 20, 2024
0a89a99
Merge branch 'main' into nitro
chrispader Oct 2, 2024
9667c93
fix: import
chrispader Oct 2, 2024
45e5c31
fix: load OnLoad TurboModule only on Android
chrispader Oct 2, 2024
fdc436f
fix: typescript build
chrispader Oct 3, 2024
ad3eeae
simplify npm setup
chrispader Oct 3, 2024
1fa3b52
Merge branch 'main' into nitro
chrispader Oct 4, 2024
dc46984
Remove ignored files
chrispader Oct 4, 2024
d636227
update Podfile.lock
chrispader Oct 4, 2024
5cfe53b
update build.gradle
chrispader Oct 4, 2024
3ceb56e
Merge branch 'main' into nitro
chrispader Oct 4, 2024
1372e54
Merge branch 'main' into nitro
chrispader Oct 14, 2024
fbc7330
chore: include podspec file
chrispader Oct 14, 2024
d83ce8e
chore: include nitrogen files in package
chrispader Oct 14, 2024
a58e9ac
update nitro
chrispader Oct 14, 2024
2683477
fix: TS errors
chrispader Oct 14, 2024
39558b1
chore: update nitro specs
chrispader Oct 14, 2024
5d95e6b
Merge branch 'main' into nitro
chrispader Oct 14, 2024
ebbbfa8
fix: turbomodule specs
chrispader Oct 14, 2024
834c8df
resolve dependency cycle
chrispader Oct 16, 2024
88a24ee
fix: require cycle
chrispader Oct 16, 2024
f418710
fix: further resolve dependency cycle
chrispader Oct 16, 2024
11ec70b
Merge branch 'main' into nitro
chrispader Oct 16, 2024
796d042
fix: NULL x string comparison crash
chrispader Oct 16, 2024
9571e51
fix: improve string comparison
chrispader Oct 16, 2024
0d4a535
fix: inline mapSQLiteTypeToColumnType
chrispader Oct 16, 2024
e8389fb
fix: null check
chrispader Oct 16, 2024
dfee311
feat: add ios performance mode
chrispader Oct 17, 2024
37b6228
Merge branch 'main' into nitro
chrispader Oct 18, 2024
46cbac8
update nitro-modules in example
chrispader Oct 25, 2024
dacf029
chore: update nitrogen
chrispader Oct 25, 2024
0d48277
update specs
chrispader Oct 25, 2024
c1d8752
chore(deps): add nitro-modules dev dependency
chrispader Oct 25, 2024
679ecf1
chore: add "src/main/cpp" to Cmake include directories
chrispader Oct 25, 2024
935ccf6
Merge branch 'main' into nitro
chrispader Oct 25, 2024
910063b
fix: lint and ts config
chrispader Nov 5, 2024
99d0e42
fix: lint and ts errors
chrispader Nov 5, 2024
cef2c9a
chore: fix bootstrap script
chrispader Nov 5, 2024
6161d79
Merge branch 'main' into nitro
chrispader Nov 13, 2024
4a13a74
fix: ts and lint
chrispader Nov 13, 2024
a1b14fa
simplify CMakeLists
chrispader Nov 13, 2024
dc72c40
fix: missing )
chrispader Nov 13, 2024
31fee9f
add "doNotStrip" to package build.gradle
chrispader Nov 13, 2024
1776179
Merge branch 'main' into nitro
chrispader Nov 13, 2024
ebca8b1
Merge branch 'main' into nitro
chrispader Nov 13, 2024
7afb7f9
fix: nitro.json
chrispader Nov 13, 2024
20570b2
fix: nitrogen autolinking files
chrispader Nov 13, 2024
de3cd32
fix: podspec
chrispader Nov 13, 2024
96e6af4
fix: Podfile.lock
chrispader Nov 13, 2024
d5c3dde
fix: oldarch build
chrispader Nov 13, 2024
5003247
fix: newarch build
chrispader Nov 13, 2024
617f178
fix: oldarch android build
chrispader Nov 13, 2024
40b4e11
fix: cpp workflow
chrispader Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/lint-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- "**/*.cpp"
- "**/*.c"
- "**/*.mm"
paths-ignore:
- "node_modules"
- "**/node_modules"
pull_request:
paths:
- ".github/workflows/lint-cpp.yml"
Expand All @@ -19,6 +22,9 @@ on:
- "**/*.cpp"
- "**/*.c"
- "**/*.mm"
paths-ignore:
- "node_modules"
- "**/node_modules"

jobs:
lint:
Expand Down
Binary file modified bun.lockb
Binary file not shown.
76 changes: 51 additions & 25 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ PODS:
- hermes-engine (0.76.1):
- hermes-engine/Pre-built (= 0.76.1)
- hermes-engine/Pre-built (0.76.1)
- NitroModules (0.16.1):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RCT-Folly (2024.01.01.00):
- boost
- DoubleConversion
Expand Down Expand Up @@ -1242,27 +1263,6 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-quick-sqlite (8.2.5):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-safe-area-context (4.14.0):
- DoubleConversion
- glog
Expand Down Expand Up @@ -1596,6 +1596,28 @@ PODS:
- React-logger (= 0.76.1)
- React-perflogger (= 0.76.1)
- React-utils (= 0.76.1)
- RNQuickSQLite (8.2.5):
- DoubleConversion
- glog
- hermes-engine
- NitroModules
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNScreens (3.35.0):
- DoubleConversion
- glog
Expand Down Expand Up @@ -1651,6 +1673,7 @@ DEPENDENCIES:
- fmt (from `../../node_modules/react-native/third-party-podspecs/fmt.podspec`)
- glog (from `../../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- NitroModules (from `../../node_modules/react-native-nitro-modules`)
- RCT-Folly (from `../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCT-Folly/Fabric (from `../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTDeprecation (from `../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`)
Expand Down Expand Up @@ -1682,7 +1705,6 @@ DEPENDENCIES:
- React-logger (from `../../node_modules/react-native/ReactCommon/logger`)
- React-Mapbuffer (from `../../node_modules/react-native/ReactCommon`)
- React-microtasksnativemodule (from `../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)
- react-native-quick-sqlite (from `../../package`)
- react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`)
- React-nativeconfig (from `../../node_modules/react-native/ReactCommon`)
- React-NativeModulesApple (from `../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
Expand Down Expand Up @@ -1711,6 +1733,7 @@ DEPENDENCIES:
- React-utils (from `../../node_modules/react-native/ReactCommon/react/utils`)
- ReactCodegen (from `build/generated/ios`)
- ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`)
- RNQuickSQLite (from `../../package`)
- RNScreens (from `../../node_modules/react-native-screens`)
- Yoga (from `../../node_modules/react-native/ReactCommon/yoga`)

Expand All @@ -1732,6 +1755,8 @@ EXTERNAL SOURCES:
hermes-engine:
:podspec: "../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
:tag: hermes-2024-09-09-RNv0.76.0-db6d12e202e15f7a446d8848d6ca8f7abb3cfb32
NitroModules:
:path: "../../node_modules/react-native-nitro-modules"
RCT-Folly:
:podspec: "../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
RCTDeprecation:
Expand Down Expand Up @@ -1790,8 +1815,6 @@ EXTERNAL SOURCES:
:path: "../../node_modules/react-native/ReactCommon"
React-microtasksnativemodule:
:path: "../../node_modules/react-native/ReactCommon/react/nativemodule/microtasks"
react-native-quick-sqlite:
:path: "../../package"
react-native-safe-area-context:
:path: "../../node_modules/react-native-safe-area-context"
React-nativeconfig:
Expand Down Expand Up @@ -1848,6 +1871,8 @@ EXTERNAL SOURCES:
:path: build/generated/ios
ReactCommon:
:path: "../../node_modules/react-native/ReactCommon"
RNQuickSQLite:
:path: "../../package"
RNScreens:
:path: "../../node_modules/react-native-screens"
Yoga:
Expand All @@ -1860,6 +1885,7 @@ SPEC CHECKSUMS:
fmt: 10c6e61f4be25dc963c36bd73fc7b1705fe975be
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
hermes-engine: 46f1ffbf0297f4298862068dd4c274d4ac17a1fd
NitroModules: 69af449f389d4c548848a400e1270f672a64e5a3
RCT-Folly: bf5c0376ffe4dd2cf438dcf86db385df9fdce648
RCTDeprecation: fde92935b3caa6cb65cbff9fbb7d3a9867ffb259
RCTRequired: 75c6cee42d21c1530a6f204ba32ff57335d19007
Expand Down Expand Up @@ -1889,7 +1915,6 @@ SPEC CHECKSUMS:
React-logger: 97c9dafae1f1a638001a9d1d0e93d431f2f9cb7b
React-Mapbuffer: 3146a13424f9fec2ea1f1462d49d566e4d69b732
React-microtasksnativemodule: 02d218c79c72d373a92a8552183f4ead0d1c6e05
react-native-quick-sqlite: 975bea33bc233f8cd468b3a27c50d88521ade800
react-native-safe-area-context: 2500e4fe998caad50ad3bc51ec23ef951308569e
React-nativeconfig: 93fe8c85a8c40820c57814e30f3e44b94c995a7b
React-NativeModulesApple: b3e076fd0d7b73417fe1e8c8b26e3c57ae9b74aa
Expand Down Expand Up @@ -1918,6 +1943,7 @@ SPEC CHECKSUMS:
React-utils: 5362bd16a9563f9916e7a56c011ddc533507650f
ReactCodegen: 4e26d365313307cc7c95e693529e539acfb5c64c
ReactCommon: 422e364463f33e336fc4db196aeb50fd801d90d6
RNQuickSQLite: 8ef02913f22a4ca65f44cf826acd0185aa5d6771
RNScreens: e389d6a6a66a4f0d3662924ecae803073ccce8ec
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: db69236006b8b1c6d55ab453390c882306cbf219
Expand Down
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"expo-status-bar": "^1.12.1",
"react": "*",
"react-native": "*",
"react-native-nitro-modules": "*",
"react-native-quick-sqlite": "8.2.5",
"react-native-safe-area-context": "^4.14.0",
"react-native-screens": "^3.35.0",
Expand Down
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const Stack = createNativeStackNavigator<ParamList>()
export default function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="QuickSQLite Example">
<Stack.Screen name="QuickSQLite Example" component={HomeScreen} />
<Stack.Navigator initialRouteName="NitroSQLite Example">
<Stack.Screen name="NitroSQLite Example" component={HomeScreen} />
<Stack.Screen name="Unit Tests" component={UnitTestScreen} />
<Stack.Screen name="Benchmarks" component={BenchmarkScreen} />
</Stack.Navigator>
Expand Down
2 changes: 1 addition & 1 deletion example/src/navigation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export type ParamList = {
'QuickSQLite Example': undefined
'NitroSQLite Example': undefined
'Unit Tests': undefined
'Benchmarks': undefined
}
4 changes: 2 additions & 2 deletions example/src/screens/BenchmarkScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const BenchmarkScreen: React.FC<Props> = () => {

setResults({})
setIsLoading(true)
console.log('--------- BEGINNING QuickSQLite BENCHMARKS ---------')
console.log('--------- BEGINNING NitroSQLite BENCHMARKS ---------')

async function start(i = 0): Promise<void> {
const benchmark = benchmarks[i]!
Expand All @@ -121,7 +121,7 @@ export const BenchmarkScreen: React.FC<Props> = () => {

await start()

console.log('--------- FINISHED QuickSQLite BENCHMARKS! ---------')
console.log('--------- FINISHED NitroSQLite BENCHMARKS! ---------')
setIsLoading(false)
}, [])

Expand Down
2 changes: 1 addition & 1 deletion example/src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ParamList } from '../navigation'
import { StatusBar } from 'expo-status-bar'
import { ScreenStyles } from '../styles'

type Props = NativeStackScreenProps<ParamList, 'QuickSQLite Example'>
type Props = NativeStackScreenProps<ParamList, 'NitroSQLite Example'>

export const HomeScreen: React.FC<Props> = ({ navigation }) => {
return (
Expand Down
15 changes: 8 additions & 7 deletions example/src/tests/db.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Chance from 'chance'
import type {
QuickSQLiteConnection,
SQLBatchTuple,
BatchQueryCommand,
} from 'react-native-quick-sqlite'
import { open } from 'react-native-quick-sqlite'

Expand All @@ -24,7 +24,7 @@ export function resetTestDb() {

// Copyright 2024 Oscar Franco
// Taken from "op-sqlite" example project.
// Used to demonstrate the performance of QuickSQLite.
// Used to demonstrate the performance of NitroSQLite.
const ROWS = 300000
export let largeDb: QuickSQLiteConnection | undefined
export function resetLargeDb() {
Expand All @@ -43,11 +43,12 @@ export function resetLargeDb() {

largeDb.execute('PRAGMA mmap_size=268435456')

const insertions: SQLBatchTuple[] = []
const insertions: BatchQueryCommand[] = []
for (let i = 0; i < ROWS; i++) {
insertions.push([
'INSERT INTO "Test" (id, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
[
insertions.push({
query:
'INSERT INTO "Test" (id, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
params: [
i,
chance.name(),
chance.name(),
Expand All @@ -64,7 +65,7 @@ export function resetLargeDb() {
chance.floating(),
chance.floating(),
],
])
})
}

largeDb.executeBatch(insertions)
Expand Down
48 changes: 25 additions & 23 deletions example/src/tests/unitTests.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Chance from 'chance'
import type {
QuickSQLiteConnection,
SQLBatchTuple,
BatchQueryCommand,
} from 'react-native-quick-sqlite'
import { beforeEach, describe, it } from './MochaRNAdapter'
import chai from 'chai'
import { testDb as testDbInternal, resetTestDb } from './db'
import type { User } from '../model/User'
import { User } from '../model/User'

function isError(e: unknown): e is Error {
return e instanceof Error
Expand Down Expand Up @@ -424,10 +424,8 @@ export function registerUnitTests() {
})
} catch (e) {
if (isError(e)) {
console.log(e.message)

expect(e.message)
.to.include('SQL execution error')
.to.include('SqlExecutionError')
.and.to.include('cannot store TEXT value in REAL column User.id')

const res = testDb.execute('SELECT * FROM User')
Expand Down Expand Up @@ -578,15 +576,17 @@ export function registerUnitTests() {
const name2 = chance.name()
const age2 = chance.integer()
const networth2 = chance.floating()
const commands: SQLBatchTuple[] = [
[
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
[id1, name1, age1, networth1],
],
[
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
[id2, name2, age2, networth2],
],
const commands: BatchQueryCommand[] = [
{
query:
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
params: [id1, name1, age1, networth1],
},
{
query:
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
params: [id2, name2, age2, networth2],
},
]

testDb.executeBatch(commands)
Expand All @@ -612,15 +612,17 @@ export function registerUnitTests() {
const name2 = chance.name()
const age2 = chance.integer()
const networth2 = chance.floating()
const commands: SQLBatchTuple[] = [
[
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
[id1, name1, age1, networth1],
],
[
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
[id2, name2, age2, networth2],
],
const commands: BatchQueryCommand[] = [
{
query:
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
params: [id1, name1, age1, networth1],
},
{
query:
'INSERT INTO "User" (id, name, age, networth) VALUES(?, ?, ?, ?)',
params: [id2, name2, age2, networth2],
},
]

await testDb.executeBatchAsync(commands)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"dependencies": {
"patch-package": "^8.0.0",
"react": "18.3.1",
"react-native": "0.76.1"
"react-native": "0.76.1",
"react-native-nitro-modules": "^0.16.1"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand All @@ -55,6 +56,7 @@
"eslint": "8.57.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"nitro-codegen": "^0.16.1",
"prettier": "^3.3.3",
"release-it": "^17.10.0",
"typescript": "~5.5.4",
Expand Down
Loading
Loading