react-native-nitro-sqlite 9.2.2 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +1 -1
- package/cpp/NitroSQLiteException.hpp +1 -2
- package/cpp/{specs → hybridObjects}/HybridNitroSQLite.cpp +64 -16
- package/cpp/{specs → hybridObjects}/HybridNitroSQLite.hpp +6 -6
- package/cpp/hybridObjects/HybridNitroSQLiteQueryResult.cpp +93 -0
- package/cpp/hybridObjects/HybridNitroSQLiteQueryResult.hpp +47 -0
- package/cpp/operations.cpp +16 -12
- package/cpp/operations.hpp +3 -1
- package/cpp/sqliteExecuteBatch.cpp +2 -2
- package/cpp/sqliteExecuteBatch.hpp +2 -2
- package/cpp/types.hpp +4 -14
- package/ios/NitroSQLite.xcodeproj/project.pbxproj +2 -2
- package/lib/commonjs/index.js +0 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/operations/execute.js +19 -32
- package/lib/commonjs/operations/execute.js.map +1 -1
- package/lib/commonjs/operations/executeBatch.js +2 -19
- package/lib/commonjs/operations/executeBatch.js.map +1 -1
- package/lib/commonjs/specs/{NativeQueryResult.nitro.js → NitroSQLiteQueryResult.nitro.js} +1 -1
- package/lib/commonjs/specs/NitroSQLiteQueryResult.nitro.js.map +1 -0
- package/lib/commonjs/types.js +1 -8
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/operations/execute.js +19 -33
- package/lib/module/operations/execute.js.map +1 -1
- package/lib/module/operations/executeBatch.js +2 -19
- package/lib/module/operations/executeBatch.js.map +1 -1
- package/lib/module/specs/NitroSQLiteQueryResult.nitro.js +4 -0
- package/lib/module/specs/NitroSQLiteQueryResult.nitro.js.map +1 -0
- package/lib/module/types.js +0 -12
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +0 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/execute.d.ts +1 -1
- package/lib/typescript/commonjs/operations/execute.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/executeBatch.d.ts +1 -1
- package/lib/typescript/commonjs/operations/executeBatch.d.ts.map +1 -1
- package/lib/typescript/commonjs/operations/transaction.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts +6 -6
- package/lib/typescript/commonjs/specs/NitroSQLite.nitro.d.ts.map +1 -1
- package/lib/typescript/{module/specs/NativeQueryResult.nitro.d.ts → commonjs/specs/NitroSQLiteQueryResult.nitro.d.ts} +7 -13
- package/lib/typescript/commonjs/specs/NitroSQLiteQueryResult.nitro.d.ts.map +1 -0
- package/lib/typescript/commonjs/typeORM.d.ts +1 -1
- package/lib/typescript/commonjs/typeORM.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +21 -37
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +0 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/operations/execute.d.ts +1 -1
- package/lib/typescript/module/operations/execute.d.ts.map +1 -1
- package/lib/typescript/module/operations/executeBatch.d.ts +1 -1
- package/lib/typescript/module/operations/executeBatch.d.ts.map +1 -1
- package/lib/typescript/module/operations/transaction.d.ts.map +1 -1
- package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts +6 -6
- package/lib/typescript/module/specs/NitroSQLite.nitro.d.ts.map +1 -1
- package/lib/typescript/{commonjs/specs/NativeQueryResult.nitro.d.ts → module/specs/NitroSQLiteQueryResult.nitro.d.ts} +7 -13
- package/lib/typescript/module/specs/NitroSQLiteQueryResult.nitro.d.ts.map +1 -0
- package/lib/typescript/module/typeORM.d.ts +1 -1
- package/lib/typescript/module/typeORM.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +21 -37
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/nitrogen/generated/android/RNNitroSQLite+autolinking.cmake +9 -6
- package/nitrogen/generated/android/RNNitroSQLite+autolinking.gradle +1 -1
- package/nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp +2 -4
- package/nitrogen/generated/android/RNNitroSQLiteOnLoad.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp +14 -1
- package/nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.hpp +4 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoadSpec.kt +8 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite+autolinking.rb +2 -2
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/RNNitroSQLite-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.mm +1 -1
- package/nitrogen/generated/ios/RNNitroSQLiteAutolinking.swift +5 -1
- package/nitrogen/generated/shared/c++/BatchQueryCommand.hpp +92 -0
- package/nitrogen/generated/shared/c++/BatchQueryResult.hpp +25 -11
- package/nitrogen/generated/shared/c++/ColumnType.hpp +5 -7
- package/nitrogen/generated/shared/c++/FileLoadResult.hpp +28 -14
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteQueryResultSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteQueryResultSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.hpp +12 -16
- package/nitrogen/generated/shared/c++/NitroSQLiteQueryColumnMetadata.hpp +93 -0
- package/package.json +5 -5
- package/src/index.ts +0 -6
- package/src/operations/execute.ts +23 -58
- package/src/operations/executeBatch.ts +3 -41
- package/src/operations/session.ts +1 -1
- package/src/operations/transaction.ts +1 -1
- package/src/specs/NitroSQLite.nitro.ts +9 -12
- package/src/specs/{NativeQueryResult.nitro.ts → NitroSQLiteQueryResult.nitro.ts} +15 -17
- package/src/typeORM.ts +1 -1
- package/src/types.ts +28 -45
- package/cpp/specs/HybridNativeQueryResult.cpp +0 -21
- package/cpp/specs/HybridNativeQueryResult.hpp +0 -27
- package/lib/commonjs/nullHandling.js +0 -33
- package/lib/commonjs/nullHandling.js.map +0 -1
- package/lib/commonjs/specs/NativeQueryResult.nitro.js.map +0 -1
- package/lib/module/nullHandling.js +0 -25
- package/lib/module/nullHandling.js.map +0 -1
- package/lib/module/specs/NativeQueryResult.nitro.js +0 -4
- package/lib/module/specs/NativeQueryResult.nitro.js.map +0 -1
- package/lib/typescript/commonjs/nullHandling.d.ts +0 -8
- package/lib/typescript/commonjs/nullHandling.d.ts.map +0 -1
- package/lib/typescript/commonjs/specs/NativeQueryResult.nitro.d.ts.map +0 -1
- package/lib/typescript/module/nullHandling.d.ts +0 -8
- package/lib/typescript/module/nullHandling.d.ts.map +0 -1
- package/lib/typescript/module/specs/NativeQueryResult.nitro.d.ts.map +0 -1
- package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.cpp +0 -24
- package/nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.hpp +0 -77
- package/nitrogen/generated/shared/c++/NativeBatchQueryCommand.hpp +0 -81
- package/nitrogen/generated/shared/c++/SQLiteNullValue.hpp +0 -69
- package/nitrogen/generated/shared/c++/SQLiteQueryColumnMetadata.hpp +0 -79
- package/src/nullHandling.ts +0 -35
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
-
import type { BatchQueryResult, FileLoadResult,
|
|
3
|
-
import type {
|
|
2
|
+
import type { BatchQueryCommand, BatchQueryResult, FileLoadResult, SQLiteQueryParams } from '../types';
|
|
3
|
+
import type { NitroSQLiteQueryResult } from './NitroSQLiteQueryResult.nitro';
|
|
4
4
|
export interface NitroSQLite extends HybridObject<{
|
|
5
5
|
ios: 'c++';
|
|
6
6
|
android: 'c++';
|
|
@@ -10,10 +10,10 @@ export interface NitroSQLite extends HybridObject<{
|
|
|
10
10
|
drop(dbName: string, location?: string): void;
|
|
11
11
|
attach(mainDbName: string, dbNameToAttach: string, alias: string, location?: string): void;
|
|
12
12
|
detach(mainDbName: string, alias: string): void;
|
|
13
|
-
execute(dbName: string, query: string, params?:
|
|
14
|
-
executeAsync(dbName: string, query: string, params?:
|
|
15
|
-
executeBatch(dbName: string, commands:
|
|
16
|
-
executeBatchAsync(dbName: string, commands:
|
|
13
|
+
execute(dbName: string, query: string, params?: SQLiteQueryParams): NitroSQLiteQueryResult;
|
|
14
|
+
executeAsync(dbName: string, query: string, params?: SQLiteQueryParams): Promise<NitroSQLiteQueryResult>;
|
|
15
|
+
executeBatch(dbName: string, commands: BatchQueryCommand[]): BatchQueryResult;
|
|
16
|
+
executeBatchAsync(dbName: string, commands: BatchQueryCommand[]): Promise<BatchQueryResult>;
|
|
17
17
|
loadFile(dbName: string, location: string): FileLoadResult;
|
|
18
18
|
loadFileAsync(dbName: string, location: string): Promise<FileLoadResult>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NitroSQLite.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NitroSQLite.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"NitroSQLite.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NitroSQLite.nitro.ts"],"names":[],"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AAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAA;IAC1D,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;CACzE"}
|
|
@@ -8,31 +8,25 @@ import type { ColumnType, SQLiteValue } from '../types';
|
|
|
8
8
|
* rows: if status is undefined or 0 this object will contain the query results
|
|
9
9
|
* }
|
|
10
10
|
*
|
|
11
|
-
* @interface
|
|
11
|
+
* @interface QueryResult
|
|
12
12
|
*/
|
|
13
|
-
export interface
|
|
13
|
+
export interface NitroSQLiteQueryResult extends HybridObject<{
|
|
14
14
|
ios: 'c++';
|
|
15
15
|
android: 'c++';
|
|
16
16
|
}> {
|
|
17
17
|
readonly rowsAffected: number;
|
|
18
18
|
readonly insertId?: number;
|
|
19
19
|
/** Query results */
|
|
20
|
-
readonly results:
|
|
20
|
+
readonly results: Record<string, SQLiteValue>[];
|
|
21
21
|
/** Table metadata */
|
|
22
|
-
readonly metadata?: Record<string,
|
|
22
|
+
readonly metadata?: Record<string, NitroSQLiteQueryColumnMetadata>;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
* Table metadata
|
|
26
|
-
* Describes some information about the table and it's columns fetched by the query
|
|
27
|
-
* The index is the name of the column
|
|
28
|
-
*/
|
|
29
|
-
export type NativeSQLiteQueryResults = Record<string, SQLiteValue>[];
|
|
30
|
-
export interface SQLiteQueryColumnMetadata {
|
|
24
|
+
export type NitroSQLiteQueryColumnMetadata = {
|
|
31
25
|
/** The name used for this column for this result set */
|
|
32
26
|
name: string;
|
|
33
27
|
/** The declared column type for this column, when fetched directly from a table or a View resulting from a table column. "UNKNOWN" for dynamic values, like function returned ones. */
|
|
34
28
|
type: ColumnType;
|
|
35
29
|
/** The index for this column for this result set */
|
|
36
30
|
index: number;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=NitroSQLiteQueryResult.nitro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NitroSQLiteQueryResult.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NitroSQLiteQueryResult.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEvD;;;;;;;;;GASG;AACH,MAAM,WAAW,sBACf,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;IACpD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAE1B,oBAAoB;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAA;IAE/C,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAA;CACnE;AASD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAA;IAEZ,uLAAuL;IACvL,IAAI,EAAE,UAAU,CAAA;IAEhB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;CACd,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Transaction, SQLiteQueryParams, QueryResultRow, QueryResult } from './types';
|
|
2
2
|
interface TypeOrmNitroSQLiteConnection {
|
|
3
3
|
executeSql: <RowData extends QueryResultRow = never>(sql: string, params: SQLiteQueryParams | undefined, okExecute: (res: QueryResult<RowData>) => void, failExecute: (msg: string) => void) => Promise<void>;
|
|
4
4
|
transaction: (fn: (tx: Transaction) => Promise<void>) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeORM.d.ts","sourceRoot":"","sources":["../../../src/typeORM.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"typeORM.d.ts","sourceRoot":"","sources":["../../../src/typeORM.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,WAAW,EACZ,MAAM,SAAS,CAAA;AAGhB,UAAU,4BAA4B;IACpC,UAAU,EAAE,CAAC,OAAO,SAAS,cAAc,GAAG,KAAK,EACjD,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,SAAS,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,IAAI,EAC9C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC/B,OAAO,CAAC,IAAI,CAAC,CAAA;IAClB,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAA;IACrE,MAAM,EAAE,CACN,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,IAAI,KACjB,IAAI,CAAA;IACT,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;CACtD;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;4BAEb;QACP,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,MACG,CAAC,EAAE,EAAE,4BAA4B,KAAK,IAAI,QACxC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,KAC1B,4BAA4B,GAAG,IAAI;CAuDvC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NitroSQLiteQueryResult } from './specs/NitroSQLiteQueryResult.nitro';
|
|
1
2
|
export interface NitroSQLiteConnectionOptions {
|
|
2
3
|
name: string;
|
|
3
4
|
location?: string;
|
|
@@ -23,39 +24,29 @@ export declare enum ColumnType {
|
|
|
23
24
|
ARRAY_BUFFER = 4,
|
|
24
25
|
NULL_VALUE = 5
|
|
25
26
|
}
|
|
26
|
-
export type
|
|
27
|
-
|
|
27
|
+
export type SQLiteValue = boolean | number | string | ArrayBuffer | null;
|
|
28
|
+
export type SQLiteQueryParams = SQLiteValue[];
|
|
29
|
+
export type QueryResultRow = Record<string, SQLiteValue>;
|
|
30
|
+
export type QueryResult<Row extends QueryResultRow = QueryResultRow> = NitroSQLiteQueryResult & {
|
|
31
|
+
/** Query results in a row format for TypeORM compatibility */
|
|
32
|
+
rows: NitroSQLiteQueryResultRows<Row>;
|
|
28
33
|
};
|
|
29
|
-
export type
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
readonly rowsAffected: number;
|
|
42
|
-
readonly rows?: {
|
|
43
|
-
/** Raw array with all dataset */
|
|
44
|
-
_array: Row[];
|
|
45
|
-
/** The lengh of the dataset */
|
|
46
|
-
length: number;
|
|
47
|
-
/** A convenience function to acess the index based the row object
|
|
48
|
-
* @param idx the row index
|
|
49
|
-
* @returns the row structure identified by column names
|
|
50
|
-
*/
|
|
51
|
-
item: (idx: number) => Row | undefined;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export type ExecuteQuery = <Row extends QueryResultRow = QueryResultRow>(query: string, params?: SQLiteQueryParams) => QueryResult<Row>;
|
|
34
|
+
export type NitroSQLiteQueryResultRows<Row extends Record<string, SQLiteValue> = Record<string, SQLiteValue>> = {
|
|
35
|
+
/** Raw array with all dataset */
|
|
36
|
+
_array: Row[];
|
|
37
|
+
/** The lengh of the dataset */
|
|
38
|
+
length: number;
|
|
39
|
+
/** A convenience function to acess the index based the row object
|
|
40
|
+
* @param idx the row index
|
|
41
|
+
* @returns the row structure identified by column names
|
|
42
|
+
*/
|
|
43
|
+
item: (idx: number) => Row | undefined;
|
|
44
|
+
};
|
|
45
|
+
export type ExecuteQuery = <Row extends QueryResultRow = QueryResultRow>(query: string, params?: SQLiteValue[]) => QueryResult<Row>;
|
|
55
46
|
export type ExecuteAsyncQuery = <Row extends QueryResultRow = QueryResultRow>(query: string, params?: SQLiteQueryParams) => Promise<QueryResult<Row>>;
|
|
56
47
|
export interface Transaction {
|
|
57
|
-
commit():
|
|
58
|
-
rollback():
|
|
48
|
+
commit(): NitroSQLiteQueryResult;
|
|
49
|
+
rollback(): NitroSQLiteQueryResult;
|
|
59
50
|
execute: ExecuteQuery;
|
|
60
51
|
executeAsync: ExecuteAsyncQuery;
|
|
61
52
|
}
|
|
@@ -69,13 +60,6 @@ export interface BatchQueryCommand {
|
|
|
69
60
|
query: string;
|
|
70
61
|
params?: SQLiteQueryParams | SQLiteQueryParams[];
|
|
71
62
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Used internally to transform the batch query commands into a native format without nullish values
|
|
74
|
-
*/
|
|
75
|
-
export interface NativeBatchQueryCommand {
|
|
76
|
-
query: string;
|
|
77
|
-
params?: NativeSQLiteQueryParams | NativeSQLiteQueryParams[];
|
|
78
|
-
}
|
|
79
63
|
/**
|
|
80
64
|
* status: 0 or undefined for correct execution, 1 for error
|
|
81
65
|
* message: if status === 1, here you will find error description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,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FY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a CMake file that adds all files generated by Nitrogen
|
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/RNNitroSQLite+autolinking.cmake)
|
|
14
14
|
# ```
|
|
15
15
|
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_RNNITROSQLITE_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
16
22
|
# Add all headers that were generated by Nitrogen
|
|
17
23
|
include_directories(
|
|
18
24
|
"../nitrogen/generated/shared/c++"
|
|
@@ -27,19 +33,16 @@ target_sources(
|
|
|
27
33
|
# Autolinking Setup
|
|
28
34
|
../nitrogen/generated/android/RNNitroSQLiteOnLoad.cpp
|
|
29
35
|
# Shared Nitrogen C++ sources
|
|
30
|
-
../nitrogen/generated/shared/c++/HybridNativeQueryResultSpec.cpp
|
|
31
36
|
../nitrogen/generated/shared/c++/HybridNitroSQLiteSpec.cpp
|
|
32
37
|
../nitrogen/generated/shared/c++/HybridNitroSQLiteOnLoadSpec.cpp
|
|
38
|
+
../nitrogen/generated/shared/c++/HybridNitroSQLiteQueryResultSpec.cpp
|
|
33
39
|
# Android-specific Nitrogen C++ sources
|
|
34
40
|
../nitrogen/generated/android/c++/JHybridNitroSQLiteOnLoadSpec.cpp
|
|
35
41
|
)
|
|
36
42
|
|
|
37
|
-
# Define a flag to check if we are building properly
|
|
38
|
-
add_definitions(-DBUILDING_RNNITROSQLITE_WITH_GENERATED_CMAKE_PROJECT)
|
|
39
|
-
|
|
40
43
|
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
41
44
|
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
42
|
-
|
|
45
|
+
target_compile_definitions(
|
|
43
46
|
RNNitroSQLite PRIVATE
|
|
44
47
|
-DFOLLY_NO_CONFIG=1
|
|
45
48
|
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLite+autolinking.gradle
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLiteOnLoad.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#ifndef BUILDING_RNNITROSQLITE_WITH_GENERATED_CMAKE_PROJECT
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
#include "JHybridNitroSQLiteOnLoadSpec.hpp"
|
|
19
19
|
#include "HybridNitroSQLite.hpp"
|
|
20
|
-
#include <NitroModules/JNISharedPtr.hpp>
|
|
21
20
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
22
21
|
|
|
23
22
|
namespace margelo::nitro::rnnitrosqlite {
|
|
@@ -46,8 +45,7 @@ int initialize(JavaVM* vm) {
|
|
|
46
45
|
[]() -> std::shared_ptr<HybridObject> {
|
|
47
46
|
static DefaultConstructableObject<JHybridNitroSQLiteOnLoadSpec::javaobject> object("com/margelo/nitro/rnnitrosqlite/HybridNitroSQLiteOnLoad");
|
|
48
47
|
auto instance = object.create();
|
|
49
|
-
|
|
50
|
-
return JNISharedPtr::make_shared_from_jni<JHybridNitroSQLiteOnLoadSpec>(globalRef);
|
|
48
|
+
return instance->cthis()->shared();
|
|
51
49
|
}
|
|
52
50
|
);
|
|
53
51
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// JHybridNitroSQLiteOnLoadSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "JHybridNitroSQLiteOnLoadSpec.hpp"
|
|
@@ -28,11 +28,24 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
28
28
|
return method(_javaPart);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
bool JHybridNitroSQLiteOnLoadSpec::equals(const std::shared_ptr<HybridObject>& other) {
|
|
32
|
+
if (auto otherCast = std::dynamic_pointer_cast<JHybridNitroSQLiteOnLoadSpec>(other)) {
|
|
33
|
+
return _javaPart == otherCast->_javaPart;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
31
38
|
void JHybridNitroSQLiteOnLoadSpec::dispose() noexcept {
|
|
32
39
|
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
33
40
|
method(_javaPart);
|
|
34
41
|
}
|
|
35
42
|
|
|
43
|
+
std::string JHybridNitroSQLiteOnLoadSpec::toString() {
|
|
44
|
+
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
45
|
+
auto javaString = method(_javaPart);
|
|
46
|
+
return javaString->toStdString();
|
|
47
|
+
}
|
|
48
|
+
|
|
36
49
|
// Properties
|
|
37
50
|
|
|
38
51
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroSQLiteOnLoadSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -29,6 +29,7 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
29
29
|
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
30
|
explicit JHybridNitroSQLiteOnLoadSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
31
|
HybridObject(HybridNitroSQLiteOnLoadSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
32
33
|
_javaPart(jni::make_global(jThis)) {}
|
|
33
34
|
|
|
34
35
|
public:
|
|
@@ -39,7 +40,9 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
39
40
|
|
|
40
41
|
public:
|
|
41
42
|
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override;
|
|
42
44
|
void dispose() noexcept override;
|
|
45
|
+
std::string toString() override;
|
|
43
46
|
|
|
44
47
|
public:
|
|
45
48
|
inline const jni::global_ref<JHybridNitroSQLiteOnLoadSpec::javaobject>& getJavaPart() const noexcept {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridNitroSQLiteOnLoadSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.rnnitrosqlite
|
|
@@ -10,7 +10,7 @@ package com.margelo.nitro.rnnitrosqlite
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import com.margelo.nitro.core
|
|
13
|
+
import com.margelo.nitro.core.HybridObject
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* A Kotlin class representing the NitroSQLiteOnLoad HybridObject.
|
|
@@ -36,6 +36,11 @@ abstract class HybridNitroSQLiteOnLoadSpec: HybridObject() {
|
|
|
36
36
|
super.updateNative(hybridData)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// Default implementation of `HybridObject.toString()`
|
|
40
|
+
override fun toString(): String {
|
|
41
|
+
return "[HybridObject NitroSQLiteOnLoad]"
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
// Properties
|
|
40
45
|
|
|
41
46
|
|
|
@@ -47,6 +52,6 @@ abstract class HybridNitroSQLiteOnLoadSpec: HybridObject() {
|
|
|
47
52
|
private external fun initHybrid(): HybridData
|
|
48
53
|
|
|
49
54
|
companion object {
|
|
50
|
-
|
|
55
|
+
protected const val TAG = "HybridNitroSQLiteOnLoadSpec"
|
|
51
56
|
}
|
|
52
57
|
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnnitrosqlite/RNNitroSQLiteOnLoad.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLiteOnLoad.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.rnnitrosqlite
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# RNNitroSQLite+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a Ruby script that adds all files generated by Nitrogen
|
|
@@ -52,7 +52,7 @@ def add_nitrogen_files(spec)
|
|
|
52
52
|
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
53
|
# Use C++ 20
|
|
54
54
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
-
# Enables C++ <-> Swift interop (by default it's only
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
56
|
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
57
|
# Enables stricter modular headers
|
|
58
58
|
"DEFINES_MODULE" => "YES",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLite-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "RNNitroSQLite-Swift-Cxx-Bridge.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RNNitroSQLiteAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
/// RNNitroSQLiteAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
8
12
|
public final class RNNitroSQLiteAutolinking {
|
|
9
13
|
public typealias bridge = margelo.nitro.rnnitrosqlite.bridge.swift
|
|
10
14
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BatchQueryCommand.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
#include <NitroModules/Null.hpp>
|
|
35
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
36
|
+
#include <variant>
|
|
37
|
+
#include <vector>
|
|
38
|
+
#include <optional>
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro::rnnitrosqlite {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A struct which can be represented as a JavaScript object (BatchQueryCommand).
|
|
44
|
+
*/
|
|
45
|
+
struct BatchQueryCommand final {
|
|
46
|
+
public:
|
|
47
|
+
std::string query SWIFT_PRIVATE;
|
|
48
|
+
std::optional<std::variant<std::vector<std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>, std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>> params SWIFT_PRIVATE;
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
BatchQueryCommand() = default;
|
|
52
|
+
explicit BatchQueryCommand(std::string query, std::optional<std::variant<std::vector<std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>, std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>> params): query(query), params(params) {}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
friend bool operator==(const BatchQueryCommand& lhs, const BatchQueryCommand& rhs) = default;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
} // namespace margelo::nitro::rnnitrosqlite
|
|
59
|
+
|
|
60
|
+
namespace margelo::nitro {
|
|
61
|
+
|
|
62
|
+
// C++ BatchQueryCommand <> JS BatchQueryCommand (object)
|
|
63
|
+
template <>
|
|
64
|
+
struct JSIConverter<margelo::nitro::rnnitrosqlite::BatchQueryCommand> final {
|
|
65
|
+
static inline margelo::nitro::rnnitrosqlite::BatchQueryCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
66
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
67
|
+
return margelo::nitro::rnnitrosqlite::BatchQueryCommand(
|
|
68
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "query"))),
|
|
69
|
+
JSIConverter<std::optional<std::variant<std::vector<std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>, std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "params")))
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::BatchQueryCommand& arg) {
|
|
73
|
+
jsi::Object obj(runtime);
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "query"), JSIConverter<std::string>::toJSI(runtime, arg.query));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "params"), JSIConverter<std::optional<std::variant<std::vector<std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>, std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>>>::toJSI(runtime, arg.params));
|
|
76
|
+
return obj;
|
|
77
|
+
}
|
|
78
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
79
|
+
if (!value.isObject()) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
jsi::Object obj = value.getObject(runtime);
|
|
83
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "query")))) return false;
|
|
87
|
+
if (!JSIConverter<std::optional<std::variant<std::vector<std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>, std::vector<std::variant<nitro::NullType, bool, std::shared_ptr<ArrayBuffer>, std::string, double>>>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "params")))) return false;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BatchQueryResult.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
#else
|
|
18
18
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
19
|
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
20
30
|
|
|
21
31
|
|
|
22
32
|
|
|
@@ -27,33 +37,34 @@ namespace margelo::nitro::rnnitrosqlite {
|
|
|
27
37
|
/**
|
|
28
38
|
* A struct which can be represented as a JavaScript object (BatchQueryResult).
|
|
29
39
|
*/
|
|
30
|
-
struct BatchQueryResult {
|
|
40
|
+
struct BatchQueryResult final {
|
|
31
41
|
public:
|
|
32
42
|
std::optional<double> rowsAffected SWIFT_PRIVATE;
|
|
33
43
|
|
|
34
44
|
public:
|
|
35
45
|
BatchQueryResult() = default;
|
|
36
46
|
explicit BatchQueryResult(std::optional<double> rowsAffected): rowsAffected(rowsAffected) {}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
friend bool operator==(const BatchQueryResult& lhs, const BatchQueryResult& rhs) = default;
|
|
37
50
|
};
|
|
38
51
|
|
|
39
52
|
} // namespace margelo::nitro::rnnitrosqlite
|
|
40
53
|
|
|
41
54
|
namespace margelo::nitro {
|
|
42
55
|
|
|
43
|
-
using namespace margelo::nitro::rnnitrosqlite;
|
|
44
|
-
|
|
45
56
|
// C++ BatchQueryResult <> JS BatchQueryResult (object)
|
|
46
57
|
template <>
|
|
47
|
-
struct JSIConverter<BatchQueryResult> final {
|
|
48
|
-
static inline BatchQueryResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
58
|
+
struct JSIConverter<margelo::nitro::rnnitrosqlite::BatchQueryResult> final {
|
|
59
|
+
static inline margelo::nitro::rnnitrosqlite::BatchQueryResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
60
|
jsi::Object obj = arg.asObject(runtime);
|
|
50
|
-
return BatchQueryResult(
|
|
51
|
-
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "rowsAffected"))
|
|
61
|
+
return margelo::nitro::rnnitrosqlite::BatchQueryResult(
|
|
62
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected")))
|
|
52
63
|
);
|
|
53
64
|
}
|
|
54
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const BatchQueryResult& arg) {
|
|
65
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rnnitrosqlite::BatchQueryResult& arg) {
|
|
55
66
|
jsi::Object obj(runtime);
|
|
56
|
-
obj.setProperty(runtime, "rowsAffected", JSIConverter<std::optional<double>>::toJSI(runtime, arg.rowsAffected));
|
|
67
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.rowsAffected));
|
|
57
68
|
return obj;
|
|
58
69
|
}
|
|
59
70
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -61,7 +72,10 @@ namespace margelo::nitro {
|
|
|
61
72
|
return false;
|
|
62
73
|
}
|
|
63
74
|
jsi::Object obj = value.getObject(runtime);
|
|
64
|
-
if (!
|
|
75
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rowsAffected")))) return false;
|
|
65
79
|
return true;
|
|
66
80
|
}
|
|
67
81
|
};
|