react-native-nitro-sqlite 9.2.2 → 9.3.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/cpp/operations.cpp +3 -3
- package/cpp/specs/HybridNitroSQLite.cpp +11 -10
- package/cpp/specs/HybridNitroSQLite.hpp +6 -6
- package/cpp/specs/HybridNitroSQLiteQueryResult.cpp +49 -0
- package/cpp/specs/{HybridNativeQueryResult.hpp → HybridNitroSQLiteQueryResult.hpp} +5 -4
- package/cpp/sqliteExecuteBatch.cpp +1 -1
- package/cpp/sqliteExecuteBatch.hpp +2 -2
- package/cpp/types.hpp +3 -4
- package/lib/commonjs/index.js +4 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/operations/execute.js +9 -26
- 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 +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/operations/execute.js +9 -27
- 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 +2 -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/commonjs/specs/{NativeQueryResult.nitro.d.ts → NitroSQLiteQueryResult.nitro.d.ts} +20 -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 +16 -37
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -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/module/specs/{NativeQueryResult.nitro.d.ts → NitroSQLiteQueryResult.nitro.d.ts} +20 -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 +16 -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 +25 -0
- package/nitrogen/generated/shared/c++/HybridNitroSQLiteQueryResultSpec.hpp +77 -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/nitrogen/generated/shared/c++/NitroSQLiteQueryResultRows.hpp +99 -0
- package/package.json +5 -5
- package/src/index.ts +3 -6
- package/src/operations/execute.ts +14 -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} +32 -17
- package/src/typeORM.ts +1 -1
- package/src/types.ts +26 -46
- package/cpp/specs/HybridNativeQueryResult.cpp +0 -21
- 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
package/src/types.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NitroSQLiteQueryColumnMetadata,
|
|
3
|
+
NitroSQLiteQueryResult,
|
|
4
|
+
NitroSQLiteQueryResultRows,
|
|
5
|
+
} from './specs/NitroSQLiteQueryResult.nitro'
|
|
6
|
+
|
|
1
7
|
export interface NitroSQLiteConnectionOptions {
|
|
2
8
|
name: string
|
|
3
9
|
location?: string
|
|
@@ -28,48 +34,30 @@ export enum ColumnType {
|
|
|
28
34
|
NULL_VALUE,
|
|
29
35
|
}
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
export type SQLiteNullValue = {
|
|
33
|
-
isNitroSQLiteNull: true
|
|
34
|
-
}
|
|
35
|
-
export type SQLiteValue =
|
|
36
|
-
| boolean
|
|
37
|
-
| number
|
|
38
|
-
| string
|
|
39
|
-
| ArrayBuffer
|
|
40
|
-
| SQLiteNullValue
|
|
37
|
+
export type SQLiteValue = boolean | number | string | ArrayBuffer | null
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
export type NativeSQLiteQueryParams = SQLiteValue[]
|
|
39
|
+
export type SQLiteQueryParams = SQLiteValue[]
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
/** The lengh of the dataset */
|
|
61
|
-
length: number
|
|
62
|
-
/** A convenience function to acess the index based the row object
|
|
63
|
-
* @param idx the row index
|
|
64
|
-
* @returns the row structure identified by column names
|
|
65
|
-
*/
|
|
66
|
-
item: (idx: number) => Row | undefined
|
|
41
|
+
export type QueryResultRow = Record<string, SQLiteValue>
|
|
42
|
+
|
|
43
|
+
export type QueryResult<Row extends QueryResultRow = QueryResultRow> =
|
|
44
|
+
NitroSQLiteQueryResult & {
|
|
45
|
+
readonly rowsAffected: number
|
|
46
|
+
readonly insertId?: number
|
|
47
|
+
|
|
48
|
+
/** Query results */
|
|
49
|
+
readonly results: Row[]
|
|
50
|
+
|
|
51
|
+
/** Query results in a row format for TypeORM compatibility */
|
|
52
|
+
readonly rows?: NitroSQLiteQueryResultRows<Row>
|
|
53
|
+
|
|
54
|
+
/** Table metadata */
|
|
55
|
+
readonly metadata?: Record<string, NitroSQLiteQueryColumnMetadata>
|
|
67
56
|
}
|
|
68
|
-
}
|
|
69
57
|
|
|
70
58
|
export type ExecuteQuery = <Row extends QueryResultRow = QueryResultRow>(
|
|
71
59
|
query: string,
|
|
72
|
-
params?:
|
|
60
|
+
params?: SQLiteValue[],
|
|
73
61
|
) => QueryResult<Row>
|
|
74
62
|
|
|
75
63
|
export type ExecuteAsyncQuery = <Row extends QueryResultRow = QueryResultRow>(
|
|
@@ -78,8 +66,8 @@ export type ExecuteAsyncQuery = <Row extends QueryResultRow = QueryResultRow>(
|
|
|
78
66
|
) => Promise<QueryResult<Row>>
|
|
79
67
|
|
|
80
68
|
export interface Transaction {
|
|
81
|
-
commit():
|
|
82
|
-
rollback():
|
|
69
|
+
commit(): NitroSQLiteQueryResult
|
|
70
|
+
rollback(): NitroSQLiteQueryResult
|
|
83
71
|
execute: ExecuteQuery
|
|
84
72
|
executeAsync: ExecuteAsyncQuery
|
|
85
73
|
}
|
|
@@ -95,14 +83,6 @@ export interface BatchQueryCommand {
|
|
|
95
83
|
params?: SQLiteQueryParams | SQLiteQueryParams[]
|
|
96
84
|
}
|
|
97
85
|
|
|
98
|
-
/**
|
|
99
|
-
* Used internally to transform the batch query commands into a native format without nullish values
|
|
100
|
-
*/
|
|
101
|
-
export interface NativeBatchQueryCommand {
|
|
102
|
-
query: string
|
|
103
|
-
params?: NativeSQLiteQueryParams | NativeSQLiteQueryParams[]
|
|
104
|
-
}
|
|
105
|
-
|
|
106
86
|
/**
|
|
107
87
|
* status: 0 or undefined for correct execution, 1 for error
|
|
108
88
|
* message: if status === 1, here you will find error description
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#include "HybridNativeQueryResult.hpp"
|
|
2
|
-
|
|
3
|
-
namespace margelo::nitro::rnnitrosqlite {
|
|
4
|
-
|
|
5
|
-
std::optional<double> HybridNativeQueryResult::getInsertId() {
|
|
6
|
-
return _result.insertId;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
double HybridNativeQueryResult::getRowsAffected() {
|
|
10
|
-
return _result.rowsAffected;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
SQLiteQueryResults HybridNativeQueryResult::getResults() {
|
|
14
|
-
return _result.results;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
std::optional<SQLiteQueryTableMetadata> HybridNativeQueryResult::getMetadata() {
|
|
18
|
-
return _result.metadata;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
} // namespace margelo::nitro::rnnitrosqlite
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NITRO_SQLITE_NULL = void 0;
|
|
7
|
-
exports.enableSimpleNullHandling = enableSimpleNullHandling;
|
|
8
|
-
exports.isNitroSQLiteNull = isNitroSQLiteNull;
|
|
9
|
-
exports.isSimpleNullHandlingEnabled = isSimpleNullHandlingEnabled;
|
|
10
|
-
exports.replaceWithNativeNullValue = replaceWithNativeNullValue;
|
|
11
|
-
let ENABLE_SIMPLE_NULL_HANDLING = false;
|
|
12
|
-
function enableSimpleNullHandling(shouldEnableSimpleNullHandling = true) {
|
|
13
|
-
ENABLE_SIMPLE_NULL_HANDLING = shouldEnableSimpleNullHandling;
|
|
14
|
-
}
|
|
15
|
-
function isSimpleNullHandlingEnabled() {
|
|
16
|
-
return ENABLE_SIMPLE_NULL_HANDLING;
|
|
17
|
-
}
|
|
18
|
-
const NITRO_SQLITE_NULL = exports.NITRO_SQLITE_NULL = {
|
|
19
|
-
isNitroSQLiteNull: true
|
|
20
|
-
};
|
|
21
|
-
function isNitroSQLiteNull(value) {
|
|
22
|
-
if (value !== null && typeof value === 'object' && 'isNitroSQLiteNull' in value) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
function replaceWithNativeNullValue(value) {
|
|
28
|
-
if (value === undefined || value === null) {
|
|
29
|
-
return NITRO_SQLITE_NULL;
|
|
30
|
-
}
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=nullHandling.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ENABLE_SIMPLE_NULL_HANDLING","enableSimpleNullHandling","shouldEnableSimpleNullHandling","isSimpleNullHandlingEnabled","NITRO_SQLITE_NULL","exports","isNitroSQLiteNull","value","replaceWithNativeNullValue","undefined"],"sourceRoot":"../../src","sources":["nullHandling.ts"],"mappings":";;;;;;;;;;AAGA,IAAIA,2BAA2B,GAAG,KAAK;AAEhC,SAASC,wBAAwBA,CACtCC,8BAA8B,GAAG,IAAI,EACrC;EACAF,2BAA2B,GAAGE,8BAA8B;AAC9D;AAEO,SAASC,2BAA2BA,CAAA,EAAG;EAC5C,OAAOH,2BAA2B;AACpC;AAEO,MAAMI,iBAAkC,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAAEE,iBAAiB,EAAE;AAAK,CAAC;AACtE,SAASA,iBAAiBA,CAACC,KAAc,EAA4B;EAC1E,IACEA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACzB,mBAAmB,IAAIA,KAAK,EAC5B;IACA,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd;AAEO,SAASC,0BAA0BA,CACxCD,KAA2B,EACd;EACb,IAAIA,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACzC,OAAOH,iBAAiB;EAC1B;EACA,OAAOG,KAAK;AACd","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/NativeQueryResult.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
let ENABLE_SIMPLE_NULL_HANDLING = false;
|
|
4
|
-
export function enableSimpleNullHandling(shouldEnableSimpleNullHandling = true) {
|
|
5
|
-
ENABLE_SIMPLE_NULL_HANDLING = shouldEnableSimpleNullHandling;
|
|
6
|
-
}
|
|
7
|
-
export function isSimpleNullHandlingEnabled() {
|
|
8
|
-
return ENABLE_SIMPLE_NULL_HANDLING;
|
|
9
|
-
}
|
|
10
|
-
export const NITRO_SQLITE_NULL = {
|
|
11
|
-
isNitroSQLiteNull: true
|
|
12
|
-
};
|
|
13
|
-
export function isNitroSQLiteNull(value) {
|
|
14
|
-
if (value !== null && typeof value === 'object' && 'isNitroSQLiteNull' in value) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
export function replaceWithNativeNullValue(value) {
|
|
20
|
-
if (value === undefined || value === null) {
|
|
21
|
-
return NITRO_SQLITE_NULL;
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=nullHandling.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ENABLE_SIMPLE_NULL_HANDLING","enableSimpleNullHandling","shouldEnableSimpleNullHandling","isSimpleNullHandlingEnabled","NITRO_SQLITE_NULL","isNitroSQLiteNull","value","replaceWithNativeNullValue","undefined"],"sourceRoot":"../../src","sources":["nullHandling.ts"],"mappings":";;AAGA,IAAIA,2BAA2B,GAAG,KAAK;AAEvC,OAAO,SAASC,wBAAwBA,CACtCC,8BAA8B,GAAG,IAAI,EACrC;EACAF,2BAA2B,GAAGE,8BAA8B;AAC9D;AAEA,OAAO,SAASC,2BAA2BA,CAAA,EAAG;EAC5C,OAAOH,2BAA2B;AACpC;AAEA,OAAO,MAAMI,iBAAkC,GAAG;EAAEC,iBAAiB,EAAE;AAAK,CAAC;AAC7E,OAAO,SAASA,iBAAiBA,CAACC,KAAc,EAA4B;EAC1E,IACEA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACzB,mBAAmB,IAAIA,KAAK,EAC5B;IACA,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd;AAEA,OAAO,SAASC,0BAA0BA,CACxCD,KAA2B,EACd;EACb,IAAIA,KAAK,KAAKE,SAAS,IAAIF,KAAK,KAAK,IAAI,EAAE;IACzC,OAAOF,iBAAiB;EAC1B;EACA,OAAOE,KAAK;AACd","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/NativeQueryResult.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SQLiteNullValue, SQLiteValue } from './types';
|
|
2
|
-
import { SQLiteQueryParamItem } from './types';
|
|
3
|
-
export declare function enableSimpleNullHandling(shouldEnableSimpleNullHandling?: boolean): void;
|
|
4
|
-
export declare function isSimpleNullHandlingEnabled(): boolean;
|
|
5
|
-
export declare const NITRO_SQLITE_NULL: SQLiteNullValue;
|
|
6
|
-
export declare function isNitroSQLiteNull(value: unknown): value is SQLiteNullValue;
|
|
7
|
-
export declare function replaceWithNativeNullValue(value: SQLiteQueryParamItem): SQLiteValue;
|
|
8
|
-
//# sourceMappingURL=nullHandling.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nullHandling.d.ts","sourceRoot":"","sources":["../../../src/nullHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAgB,wBAAwB,CACtC,8BAA8B,UAAO,QAGtC;AAED,wBAAgB,2BAA2B,YAE1C;AAED,eAAO,MAAM,iBAAiB,EAAE,eAA6C,CAAA;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAS1E;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,GAC1B,WAAW,CAKb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeQueryResult.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeQueryResult.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,iBACf,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,wBAAwB,CAAA;IAC1C,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAA;CAC9D;AAED;;;;GAIG;AAIH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAA;AAIpE,MAAM,WAAW,yBAAyB;IACxC,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAA;IACZ,uLAAuL;IACvL,IAAI,EAAE,UAAU,CAAA;IAChB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;CACd"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SQLiteNullValue, SQLiteValue } from './types';
|
|
2
|
-
import { SQLiteQueryParamItem } from './types';
|
|
3
|
-
export declare function enableSimpleNullHandling(shouldEnableSimpleNullHandling?: boolean): void;
|
|
4
|
-
export declare function isSimpleNullHandlingEnabled(): boolean;
|
|
5
|
-
export declare const NITRO_SQLITE_NULL: SQLiteNullValue;
|
|
6
|
-
export declare function isNitroSQLiteNull(value: unknown): value is SQLiteNullValue;
|
|
7
|
-
export declare function replaceWithNativeNullValue(value: SQLiteQueryParamItem): SQLiteValue;
|
|
8
|
-
//# sourceMappingURL=nullHandling.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nullHandling.d.ts","sourceRoot":"","sources":["../../../src/nullHandling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAI9C,wBAAgB,wBAAwB,CACtC,8BAA8B,UAAO,QAGtC;AAED,wBAAgB,2BAA2B,YAE1C;AAED,eAAO,MAAM,iBAAiB,EAAE,eAA6C,CAAA;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAS1E;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,oBAAoB,GAC1B,WAAW,CAKb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeQueryResult.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/NativeQueryResult.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,iBACf,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,wBAAwB,CAAA;IAC1C,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAA;CAC9D;AAED;;;;GAIG;AAIH,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAA;AAIpE,MAAM,WAAW,yBAAyB;IACxC,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAA;IACZ,uLAAuL;IACvL,IAAI,EAAE,UAAU,CAAA;IAChB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;CACd"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridNativeQueryResultSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridNativeQueryResultSpec.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::rnnitrosqlite {
|
|
11
|
-
|
|
12
|
-
void HybridNativeQueryResultSpec::loadHybridMethods() {
|
|
13
|
-
// load base methods/properties
|
|
14
|
-
HybridObject::loadHybridMethods();
|
|
15
|
-
// load custom methods/properties
|
|
16
|
-
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridGetter("rowsAffected", &HybridNativeQueryResultSpec::getRowsAffected);
|
|
18
|
-
prototype.registerHybridGetter("insertId", &HybridNativeQueryResultSpec::getInsertId);
|
|
19
|
-
prototype.registerHybridGetter("results", &HybridNativeQueryResultSpec::getResults);
|
|
20
|
-
prototype.registerHybridGetter("metadata", &HybridNativeQueryResultSpec::getMetadata);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
} // namespace margelo::nitro::rnnitrosqlite
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridNativeQueryResultSpec.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
-
#include <NitroModules/HybridObject.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
17
|
-
namespace NitroModules { class ArrayBuffer; }
|
|
18
|
-
// Forward declaration of `SQLiteNullValue` to properly resolve imports.
|
|
19
|
-
namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
|
|
20
|
-
// Forward declaration of `SQLiteQueryColumnMetadata` to properly resolve imports.
|
|
21
|
-
namespace margelo::nitro::rnnitrosqlite { struct SQLiteQueryColumnMetadata; }
|
|
22
|
-
|
|
23
|
-
#include <optional>
|
|
24
|
-
#include <string>
|
|
25
|
-
#include <NitroModules/ArrayBuffer.hpp>
|
|
26
|
-
#include "SQLiteNullValue.hpp"
|
|
27
|
-
#include <variant>
|
|
28
|
-
#include <unordered_map>
|
|
29
|
-
#include <vector>
|
|
30
|
-
#include "SQLiteQueryColumnMetadata.hpp"
|
|
31
|
-
|
|
32
|
-
namespace margelo::nitro::rnnitrosqlite {
|
|
33
|
-
|
|
34
|
-
using namespace margelo::nitro;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* An abstract base class for `NativeQueryResult`
|
|
38
|
-
* Inherit this class to create instances of `HybridNativeQueryResultSpec` in C++.
|
|
39
|
-
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
40
|
-
* @example
|
|
41
|
-
* ```cpp
|
|
42
|
-
* class HybridNativeQueryResult: public HybridNativeQueryResultSpec {
|
|
43
|
-
* public:
|
|
44
|
-
* HybridNativeQueryResult(...): HybridObject(TAG) { ... }
|
|
45
|
-
* // ...
|
|
46
|
-
* };
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
class HybridNativeQueryResultSpec: public virtual HybridObject {
|
|
50
|
-
public:
|
|
51
|
-
// Constructor
|
|
52
|
-
explicit HybridNativeQueryResultSpec(): HybridObject(TAG) { }
|
|
53
|
-
|
|
54
|
-
// Destructor
|
|
55
|
-
~HybridNativeQueryResultSpec() override = default;
|
|
56
|
-
|
|
57
|
-
public:
|
|
58
|
-
// Properties
|
|
59
|
-
virtual double getRowsAffected() = 0;
|
|
60
|
-
virtual std::optional<double> getInsertId() = 0;
|
|
61
|
-
virtual std::vector<std::unordered_map<std::string, std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>> getResults() = 0;
|
|
62
|
-
virtual std::optional<std::unordered_map<std::string, SQLiteQueryColumnMetadata>> getMetadata() = 0;
|
|
63
|
-
|
|
64
|
-
public:
|
|
65
|
-
// Methods
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
protected:
|
|
69
|
-
// Hybrid Setup
|
|
70
|
-
void loadHybridMethods() override;
|
|
71
|
-
|
|
72
|
-
protected:
|
|
73
|
-
// Tag for logging
|
|
74
|
-
static constexpr auto TAG = "NativeQueryResult";
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
} // namespace margelo::nitro::rnnitrosqlite
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// NativeBatchQueryCommand.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 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
|
-
|
|
21
|
-
// Forward declaration of `ArrayBuffer` to properly resolve imports.
|
|
22
|
-
namespace NitroModules { class ArrayBuffer; }
|
|
23
|
-
// Forward declaration of `SQLiteNullValue` to properly resolve imports.
|
|
24
|
-
namespace margelo::nitro::rnnitrosqlite { struct SQLiteNullValue; }
|
|
25
|
-
|
|
26
|
-
#include <string>
|
|
27
|
-
#include <NitroModules/ArrayBuffer.hpp>
|
|
28
|
-
#include "SQLiteNullValue.hpp"
|
|
29
|
-
#include <variant>
|
|
30
|
-
#include <vector>
|
|
31
|
-
#include <optional>
|
|
32
|
-
|
|
33
|
-
namespace margelo::nitro::rnnitrosqlite {
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A struct which can be represented as a JavaScript object (NativeBatchQueryCommand).
|
|
37
|
-
*/
|
|
38
|
-
struct NativeBatchQueryCommand {
|
|
39
|
-
public:
|
|
40
|
-
std::string query SWIFT_PRIVATE;
|
|
41
|
-
std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>> params SWIFT_PRIVATE;
|
|
42
|
-
|
|
43
|
-
public:
|
|
44
|
-
NativeBatchQueryCommand() = default;
|
|
45
|
-
explicit NativeBatchQueryCommand(std::string query, std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>> params): query(query), params(params) {}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
} // namespace margelo::nitro::rnnitrosqlite
|
|
49
|
-
|
|
50
|
-
namespace margelo::nitro {
|
|
51
|
-
|
|
52
|
-
using namespace margelo::nitro::rnnitrosqlite;
|
|
53
|
-
|
|
54
|
-
// C++ NativeBatchQueryCommand <> JS NativeBatchQueryCommand (object)
|
|
55
|
-
template <>
|
|
56
|
-
struct JSIConverter<NativeBatchQueryCommand> final {
|
|
57
|
-
static inline NativeBatchQueryCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
58
|
-
jsi::Object obj = arg.asObject(runtime);
|
|
59
|
-
return NativeBatchQueryCommand(
|
|
60
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "query")),
|
|
61
|
-
JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>>>::fromJSI(runtime, obj.getProperty(runtime, "params"))
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const NativeBatchQueryCommand& arg) {
|
|
65
|
-
jsi::Object obj(runtime);
|
|
66
|
-
obj.setProperty(runtime, "query", JSIConverter<std::string>::toJSI(runtime, arg.query));
|
|
67
|
-
obj.setProperty(runtime, "params", JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>>>::toJSI(runtime, arg.params));
|
|
68
|
-
return obj;
|
|
69
|
-
}
|
|
70
|
-
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
71
|
-
if (!value.isObject()) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
jsi::Object obj = value.getObject(runtime);
|
|
75
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "query"))) return false;
|
|
76
|
-
if (!JSIConverter<std::optional<std::variant<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>, std::vector<std::vector<std::variant<std::string, double, bool, std::shared_ptr<ArrayBuffer>, SQLiteNullValue>>>>>>::canConvert(runtime, obj.getProperty(runtime, "params"))) return false;
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
} // namespace margelo::nitro
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// SQLiteNullValue.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
namespace margelo::nitro::rnnitrosqlite {
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A struct which can be represented as a JavaScript object (SQLiteNullValue).
|
|
29
|
-
*/
|
|
30
|
-
struct SQLiteNullValue {
|
|
31
|
-
public:
|
|
32
|
-
bool isNitroSQLiteNull SWIFT_PRIVATE;
|
|
33
|
-
|
|
34
|
-
public:
|
|
35
|
-
SQLiteNullValue() = default;
|
|
36
|
-
explicit SQLiteNullValue(bool isNitroSQLiteNull): isNitroSQLiteNull(isNitroSQLiteNull) {}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
} // namespace margelo::nitro::rnnitrosqlite
|
|
40
|
-
|
|
41
|
-
namespace margelo::nitro {
|
|
42
|
-
|
|
43
|
-
using namespace margelo::nitro::rnnitrosqlite;
|
|
44
|
-
|
|
45
|
-
// C++ SQLiteNullValue <> JS SQLiteNullValue (object)
|
|
46
|
-
template <>
|
|
47
|
-
struct JSIConverter<SQLiteNullValue> final {
|
|
48
|
-
static inline SQLiteNullValue fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
49
|
-
jsi::Object obj = arg.asObject(runtime);
|
|
50
|
-
return SQLiteNullValue(
|
|
51
|
-
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isNitroSQLiteNull"))
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const SQLiteNullValue& arg) {
|
|
55
|
-
jsi::Object obj(runtime);
|
|
56
|
-
obj.setProperty(runtime, "isNitroSQLiteNull", JSIConverter<bool>::toJSI(runtime, arg.isNitroSQLiteNull));
|
|
57
|
-
return obj;
|
|
58
|
-
}
|
|
59
|
-
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
60
|
-
if (!value.isObject()) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
jsi::Object obj = value.getObject(runtime);
|
|
64
|
-
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isNitroSQLiteNull"))) return false;
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
} // namespace margelo::nitro
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// SQLiteQueryColumnMetadata.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2025 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
|
-
|
|
21
|
-
// Forward declaration of `ColumnType` to properly resolve imports.
|
|
22
|
-
namespace margelo::nitro::rnnitrosqlite { enum class ColumnType; }
|
|
23
|
-
|
|
24
|
-
#include <string>
|
|
25
|
-
#include "ColumnType.hpp"
|
|
26
|
-
|
|
27
|
-
namespace margelo::nitro::rnnitrosqlite {
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* A struct which can be represented as a JavaScript object (SQLiteQueryColumnMetadata).
|
|
31
|
-
*/
|
|
32
|
-
struct SQLiteQueryColumnMetadata {
|
|
33
|
-
public:
|
|
34
|
-
std::string name SWIFT_PRIVATE;
|
|
35
|
-
ColumnType type SWIFT_PRIVATE;
|
|
36
|
-
double index SWIFT_PRIVATE;
|
|
37
|
-
|
|
38
|
-
public:
|
|
39
|
-
SQLiteQueryColumnMetadata() = default;
|
|
40
|
-
explicit SQLiteQueryColumnMetadata(std::string name, ColumnType type, double index): name(name), type(type), index(index) {}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
} // namespace margelo::nitro::rnnitrosqlite
|
|
44
|
-
|
|
45
|
-
namespace margelo::nitro {
|
|
46
|
-
|
|
47
|
-
using namespace margelo::nitro::rnnitrosqlite;
|
|
48
|
-
|
|
49
|
-
// C++ SQLiteQueryColumnMetadata <> JS SQLiteQueryColumnMetadata (object)
|
|
50
|
-
template <>
|
|
51
|
-
struct JSIConverter<SQLiteQueryColumnMetadata> final {
|
|
52
|
-
static inline SQLiteQueryColumnMetadata fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
53
|
-
jsi::Object obj = arg.asObject(runtime);
|
|
54
|
-
return SQLiteQueryColumnMetadata(
|
|
55
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "name")),
|
|
56
|
-
JSIConverter<ColumnType>::fromJSI(runtime, obj.getProperty(runtime, "type")),
|
|
57
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "index"))
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
static inline jsi::Value toJSI(jsi::Runtime& runtime, const SQLiteQueryColumnMetadata& arg) {
|
|
61
|
-
jsi::Object obj(runtime);
|
|
62
|
-
obj.setProperty(runtime, "name", JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
63
|
-
obj.setProperty(runtime, "type", JSIConverter<ColumnType>::toJSI(runtime, arg.type));
|
|
64
|
-
obj.setProperty(runtime, "index", JSIConverter<double>::toJSI(runtime, arg.index));
|
|
65
|
-
return obj;
|
|
66
|
-
}
|
|
67
|
-
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
-
if (!value.isObject()) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
jsi::Object obj = value.getObject(runtime);
|
|
72
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "name"))) return false;
|
|
73
|
-
if (!JSIConverter<ColumnType>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
|
|
74
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "index"))) return false;
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
} // namespace margelo::nitro
|
package/src/nullHandling.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { SQLiteNullValue, SQLiteValue } from './types'
|
|
2
|
-
import { SQLiteQueryParamItem } from './types'
|
|
3
|
-
|
|
4
|
-
let ENABLE_SIMPLE_NULL_HANDLING = false
|
|
5
|
-
|
|
6
|
-
export function enableSimpleNullHandling(
|
|
7
|
-
shouldEnableSimpleNullHandling = true,
|
|
8
|
-
) {
|
|
9
|
-
ENABLE_SIMPLE_NULL_HANDLING = shouldEnableSimpleNullHandling
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function isSimpleNullHandlingEnabled() {
|
|
13
|
-
return ENABLE_SIMPLE_NULL_HANDLING
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const NITRO_SQLITE_NULL: SQLiteNullValue = { isNitroSQLiteNull: true }
|
|
17
|
-
export function isNitroSQLiteNull(value: unknown): value is SQLiteNullValue {
|
|
18
|
-
if (
|
|
19
|
-
value !== null &&
|
|
20
|
-
typeof value === 'object' &&
|
|
21
|
-
'isNitroSQLiteNull' in value
|
|
22
|
-
) {
|
|
23
|
-
return true
|
|
24
|
-
}
|
|
25
|
-
return false
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function replaceWithNativeNullValue(
|
|
29
|
-
value: SQLiteQueryParamItem,
|
|
30
|
-
): SQLiteValue {
|
|
31
|
-
if (value === undefined || value === null) {
|
|
32
|
-
return NITRO_SQLITE_NULL
|
|
33
|
-
}
|
|
34
|
-
return value
|
|
35
|
-
}
|