sql-typechecker 0.0.129 → 0.0.130
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/out/typeparsers.d.ts +6 -1
- package/out/typeparsers.ts +10 -7
- package/package.json +1 -1
package/out/typeparsers.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import { LocalDateTime } from "@js-joda/core";
|
|
1
2
|
export declare function registerSqlTypecheckerTypeParsers(): typeof import("pg-types");
|
|
2
|
-
export declare function parseTsmultirange(multirangeStr: string):
|
|
3
|
+
export declare function parseTsmultirange(multirangeStr: string): {
|
|
4
|
+
start: LocalDateTime;
|
|
5
|
+
end: LocalDateTime;
|
|
6
|
+
bounds: string;
|
|
7
|
+
}[];
|
package/out/typeparsers.ts
CHANGED
|
@@ -49,7 +49,9 @@ export function registerSqlTypecheckerTypeParsers() {
|
|
|
49
49
|
return types;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export function parseTsmultirange(
|
|
52
|
+
export function parseTsmultirange(
|
|
53
|
+
multirangeStr: string
|
|
54
|
+
): { start: LocalDateTime; end: LocalDateTime; bounds: string }[] {
|
|
53
55
|
if (multirangeStr === "{}") {
|
|
54
56
|
return []; // Return an empty array for an empty multirange.
|
|
55
57
|
}
|
|
@@ -66,12 +68,13 @@ export function parseTsmultirange(multirangeStr: string) {
|
|
|
66
68
|
const [_, startBracket, startStr, endStr, endBracket] = match;
|
|
67
69
|
|
|
68
70
|
// Remove double quotes and create Date objects.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
if (startStr === undefined || endStr === undefined) {
|
|
72
|
+
throw new Error("Invalid tsmultirange");
|
|
73
|
+
}
|
|
74
|
+
const start = LocalDateTime.parse(
|
|
75
|
+
startStr.replace(/"/g, "").replace(" ", "T")
|
|
76
|
+
);
|
|
77
|
+
const end = LocalDateTime.parse(endStr.replace(/"/g, "").replace(" ", "T"));
|
|
75
78
|
const bounds = `${startBracket}${endBracket}`;
|
|
76
79
|
|
|
77
80
|
ranges.push({
|