@housekit/orm 0.1.46 → 0.1.48

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.
Files changed (79) hide show
  1. package/README.md +47 -6
  2. package/dist/builders/delete.js +112 -0
  3. package/dist/builders/insert.d.ts +0 -91
  4. package/dist/builders/insert.js +393 -0
  5. package/dist/builders/prepared.d.ts +1 -2
  6. package/dist/builders/prepared.js +30 -0
  7. package/dist/builders/select.d.ts +0 -161
  8. package/dist/builders/select.js +562 -0
  9. package/dist/builders/select.types.js +1 -0
  10. package/dist/builders/update.js +136 -0
  11. package/dist/client.d.ts +0 -6
  12. package/dist/client.js +140 -0
  13. package/dist/codegen/zod.js +107 -0
  14. package/dist/column.d.ts +1 -25
  15. package/dist/column.js +133 -0
  16. package/dist/compiler.d.ts +0 -7
  17. package/dist/compiler.js +513 -0
  18. package/dist/core.js +6 -0
  19. package/dist/data-types.d.ts +0 -61
  20. package/dist/data-types.js +127 -0
  21. package/dist/dictionary.d.ts +0 -149
  22. package/dist/dictionary.js +158 -0
  23. package/dist/engines.d.ts +0 -385
  24. package/dist/engines.js +292 -0
  25. package/dist/expressions.d.ts +0 -10
  26. package/dist/expressions.js +268 -0
  27. package/dist/external.d.ts +0 -112
  28. package/dist/external.js +224 -0
  29. package/dist/index.d.ts +0 -51
  30. package/dist/index.js +139 -6853
  31. package/dist/logger.js +36 -0
  32. package/dist/materialized-views.d.ts +0 -188
  33. package/dist/materialized-views.js +380 -0
  34. package/dist/metadata.js +59 -0
  35. package/dist/modules/aggregates.d.ts +0 -164
  36. package/dist/modules/aggregates.js +121 -0
  37. package/dist/modules/array.d.ts +0 -98
  38. package/dist/modules/array.js +71 -0
  39. package/dist/modules/conditional.d.ts +0 -84
  40. package/dist/modules/conditional.js +138 -0
  41. package/dist/modules/conversion.d.ts +0 -147
  42. package/dist/modules/conversion.js +109 -0
  43. package/dist/modules/geo.d.ts +0 -164
  44. package/dist/modules/geo.js +112 -0
  45. package/dist/modules/hash.js +4 -0
  46. package/dist/modules/index.js +12 -0
  47. package/dist/modules/json.d.ts +0 -106
  48. package/dist/modules/json.js +76 -0
  49. package/dist/modules/math.d.ts +0 -16
  50. package/dist/modules/math.js +16 -0
  51. package/dist/modules/string.d.ts +0 -136
  52. package/dist/modules/string.js +89 -0
  53. package/dist/modules/time.d.ts +0 -123
  54. package/dist/modules/time.js +91 -0
  55. package/dist/modules/types.d.ts +0 -133
  56. package/dist/modules/types.js +114 -0
  57. package/dist/modules/window.js +140 -0
  58. package/dist/relational.d.ts +0 -82
  59. package/dist/relational.js +290 -0
  60. package/dist/relations.js +21 -0
  61. package/dist/schema-builder.d.ts +0 -90
  62. package/dist/schema-builder.js +140 -0
  63. package/dist/table.d.ts +0 -42
  64. package/dist/table.js +406 -0
  65. package/dist/utils/background-batcher.js +75 -0
  66. package/dist/utils/batch-transform.js +51 -0
  67. package/dist/utils/binary-reader.d.ts +0 -6
  68. package/dist/utils/binary-reader.js +334 -0
  69. package/dist/utils/binary-serializer.d.ts +0 -125
  70. package/dist/utils/binary-serializer.js +637 -0
  71. package/dist/utils/binary-worker-code.js +1 -0
  72. package/dist/utils/binary-worker-pool.d.ts +0 -34
  73. package/dist/utils/binary-worker-pool.js +206 -0
  74. package/dist/utils/binary-worker.d.ts +0 -11
  75. package/dist/utils/binary-worker.js +63 -0
  76. package/dist/utils/insert-processing.d.ts +0 -2
  77. package/dist/utils/insert-processing.js +163 -0
  78. package/dist/utils/lru-cache.js +30 -0
  79. package/package.json +68 -3
@@ -0,0 +1,138 @@
1
+ import { sql, SQL } from '../expressions';
2
+ export function ifNull(col, alt) {
3
+ return sql `ifNull(${col}, ${alt})`;
4
+ }
5
+ export function sqlIf(condition, trueVal, falseVal) {
6
+ return sql `if(${condition}, ${trueVal}, ${falseVal})`;
7
+ }
8
+ export function multiIf(...args) {
9
+ if (args.length < 3) {
10
+ throw new Error('multiIf requires at least 3 arguments: condition, value, default');
11
+ }
12
+ if (args.length % 2 === 0) {
13
+ throw new Error('multiIf requires an odd number of arguments: condition-value pairs plus a default value');
14
+ }
15
+ const params = args.map(arg => sql `${arg}`).join(', ');
16
+ return sql `multiIf(${params})`;
17
+ }
18
+ export function caseWhen() {
19
+ return new CaseWhenBuilder();
20
+ }
21
+ class CaseWhenBuilder {
22
+ conditions = [];
23
+ values = [];
24
+ defaultValue;
25
+ when(condition, value) {
26
+ this.conditions.push(condition);
27
+ this.values.push(value);
28
+ return this;
29
+ }
30
+ otherwise(value) {
31
+ this.defaultValue = value;
32
+ return this.build();
33
+ }
34
+ build() {
35
+ if (!this.defaultValue) {
36
+ throw new Error('CaseWhenBuilder requires a default value via .otherwise()');
37
+ }
38
+ const args = [];
39
+ for (let i = 0; i < this.conditions.length; i++) {
40
+ args.push(this.conditions[i]);
41
+ args.push(this.values[i]);
42
+ }
43
+ args.push(this.defaultValue);
44
+ return multiIf(...args);
45
+ }
46
+ }
47
+ export function coalesce(...args) {
48
+ const chunks = ['coalesce('];
49
+ const params = [];
50
+ args.forEach((arg, i) => {
51
+ params.push(arg);
52
+ if (i < args.length - 1) {
53
+ chunks.push(', ');
54
+ }
55
+ });
56
+ chunks.push(')');
57
+ return new SQL(chunks, params);
58
+ }
59
+ export function greatest(...args) {
60
+ const chunks = ['greatest('];
61
+ const params = [];
62
+ args.forEach((arg, i) => {
63
+ params.push(arg);
64
+ if (i < args.length - 1) {
65
+ chunks.push(', ');
66
+ }
67
+ });
68
+ chunks.push(')');
69
+ return new SQL(chunks, params);
70
+ }
71
+ export function least(...args) {
72
+ const chunks = ['least('];
73
+ const params = [];
74
+ args.forEach((arg, i) => {
75
+ params.push(arg);
76
+ if (i < args.length - 1) {
77
+ chunks.push(', ');
78
+ }
79
+ });
80
+ chunks.push(')');
81
+ return new SQL(chunks, params);
82
+ }
83
+ export function isNull(col) {
84
+ return sql `${col} IS NULL`;
85
+ }
86
+ export function isNotNull(col) {
87
+ return sql `${col} IS NOT NULL`;
88
+ }
89
+ export function nullIf(condition, col) {
90
+ return sql `nullIf(${col}, ${condition})`;
91
+ }
92
+ export function nullIfEqual(col, value) {
93
+ return sql `nullIf(${col}, ${value})`;
94
+ }
95
+ export function not(expr) {
96
+ return sql `NOT (${expr})`;
97
+ }
98
+ export function and(...exprs) {
99
+ const filtered = exprs.filter((e) => !!e);
100
+ if (filtered.length === 0)
101
+ return undefined;
102
+ if (filtered.length === 1)
103
+ return filtered[0];
104
+ const finalChunks = ['('];
105
+ const finalParams = [];
106
+ filtered.forEach((e, i) => {
107
+ finalParams.push(e);
108
+ if (i < filtered.length - 1) {
109
+ finalChunks.push(') AND (');
110
+ }
111
+ else {
112
+ finalChunks.push(')');
113
+ }
114
+ });
115
+ return new SQL(finalChunks, finalParams);
116
+ }
117
+ export function or(...exprs) {
118
+ const filtered = exprs.filter((e) => !!e);
119
+ if (filtered.length === 0)
120
+ return undefined;
121
+ if (filtered.length === 1)
122
+ return filtered[0];
123
+ const finalChunks = ['('];
124
+ const finalParams = [];
125
+ filtered.forEach((e, i) => {
126
+ finalParams.push(e);
127
+ if (i < filtered.length - 1) {
128
+ finalChunks.push(') OR (');
129
+ }
130
+ else {
131
+ finalChunks.push(')');
132
+ }
133
+ });
134
+ return new SQL(finalChunks, finalParams);
135
+ }
136
+ export function xor(expr1, expr2) {
137
+ return sql `xor(${expr1}, ${expr2})`;
138
+ }
@@ -1,189 +1,42 @@
1
1
  import { ClickHouseColumn } from '../core';
2
2
  import { SQLExpression } from '../expressions';
3
3
  type Expr<T = any> = ClickHouseColumn<T, any, any> | SQLExpression<T>;
4
- /**
5
- * Convert to string
6
- * @param col - Column or expression to convert
7
- */
8
4
  export declare function toString(col: Expr): SQLExpression<string>;
9
5
  export declare function toInt32(col: Expr): SQLExpression<number>;
10
- /**
11
- * Convert to integer (alias for toInt32)
12
- */
13
6
  export declare const toInteger: typeof toInt32;
14
- /**
15
- * Convert to 64-bit integer
16
- * @param col - Column or expression to convert
17
- */
18
7
  export declare function toInt64(col: Expr): SQLExpression<number>;
19
- /**
20
- * Convert to 32-bit unsigned integer
21
- * @param col - Column or expression to convert
22
- */
23
8
  export declare function toUInt32(col: Expr): SQLExpression<number>;
24
- /**
25
- * Convert to 64-bit unsigned integer
26
- * @param col - Column or expression to convert
27
- */
28
9
  export declare function toUInt64(col: Expr): SQLExpression<number>;
29
- /**
30
- * Convert to 32-bit float
31
- * @param col - Column or expression to convert
32
- */
33
10
  export declare function toFloat32(col: Expr): SQLExpression<number>;
34
- /**
35
- * Convert to 64-bit float
36
- * @param col - Column or expression to convert
37
- */
38
11
  export declare function toFloat64(col: Expr): SQLExpression<number>;
39
12
  export declare function toBool(col: Expr): SQLExpression<boolean>;
40
- /**
41
- * Convert to boolean (alias for toBool)
42
- */
43
13
  export declare const toBoolean: typeof toBool;
44
- /**
45
- * Convert to UUID
46
- * @param col - Column or expression to convert
47
- */
48
14
  export declare function toUUID(col: Expr): SQLExpression<string>;
49
- /**
50
- * Convert to Date type (without time)
51
- * @param col - Column or expression to convert
52
- */
53
15
  export declare function toDate(col: Expr): SQLExpression<string>;
54
16
  export declare function toDateTime(col: Expr): SQLExpression<string>;
55
- /**
56
- * Convert to timestamp (alias for toDateTime)
57
- */
58
17
  export declare const toTimestamp: typeof toDateTime;
59
- /**
60
- * Convert to DateTime64 type
61
- * @param col - Column or expression to convert
62
- * @param precision - DateTime precision (default: 3)
63
- */
64
18
  export declare function toDateTime64(col: Expr, precision?: number): SQLExpression<string>;
65
- /**
66
- * Convert to lowercase
67
- * @param col - Column or expression to convert
68
- */
69
19
  export declare function toLowercase(col: Expr): SQLExpression<string>;
70
- /**
71
- * Convert to uppercase
72
- * @param col - Column or expression to convert
73
- */
74
20
  export declare function toUppercase(col: Expr): SQLExpression<string>;
75
- /**
76
- * Convert to title case (first letter uppercase, rest lowercase)
77
- * @param col - Column or expression to convert
78
- */
79
21
  export declare function toTitleCase(col: Expr): SQLExpression<string>;
80
- /**
81
- * Trim whitespace from string
82
- * @param col - Column or expression to trim
83
- */
84
22
  export declare function convertTrim(col: Expr): SQLExpression<string>;
85
- /**
86
- * Trim left whitespace
87
- * @param col - Column or expression to trim
88
- */
89
23
  export declare function convertTrimLeft(col: Expr): SQLExpression<string>;
90
- /**
91
- * Trim right whitespace
92
- * @param col - Column or expression to trim
93
- */
94
24
  export declare function convertTrimRight(col: Expr): SQLExpression<string>;
95
- /**
96
- * Left pad string
97
- * @param col - Column or expression to pad
98
- * @param length - Target length
99
- * @param fill - Fill character (default: space)
100
- */
101
25
  export declare function leftPad(col: Expr, length: number, fill?: string): SQLExpression<string>;
102
- /**
103
- * Right pad string
104
- * @param col - Column or expression to pad
105
- * @param length - Target length
106
- * @param fill - Fill character (default: space)
107
- */
108
26
  export declare function rightPad(col: Expr, length: number, fill?: string): SQLExpression<string>;
109
- /**
110
- * Convert to hexadecimal string
111
- * @param col - Column or expression to convert
112
- */
113
27
  export declare function toHex(col: Expr): SQLExpression<string>;
114
- /**
115
- * Convert from hexadecimal string
116
- * @param col - Column or expression to convert
117
- */
118
28
  export declare function fromHex(col: Expr): SQLExpression<string>;
119
- /**
120
- * Convert to base64 string
121
- * @param col - Column or expression to convert
122
- */
123
29
  export declare function toBase64(col: Expr): SQLExpression<string>;
124
- /**
125
- * Convert from base64 string
126
- * @param col - Column or expression to convert
127
- */
128
30
  export declare function fromBase64(col: Expr): SQLExpression<string>;
129
- /**
130
- * Convert to binary string
131
- * @param col - Column or expression to convert
132
- */
133
31
  export declare function toBin(col: Expr): SQLExpression<string>;
134
- /**
135
- * Convert from binary string
136
- * @param col - Column or expression to convert
137
- */
138
32
  export declare function fromBin(col: Expr): SQLExpression<string>;
139
- /**
140
- * URL encode string
141
- * @param col - Column or expression to encode
142
- */
143
33
  export declare function urlEncode(col: Expr): SQLExpression<string>;
144
- /**
145
- * URL decode string
146
- * @param col - Column or expression to decode
147
- */
148
34
  export declare function urlDecode(col: Expr): SQLExpression<string>;
149
- /**
150
- * HTML escape string
151
- * @param col - Column or expression to escape
152
- */
153
35
  export declare function htmlEscape(col: Expr): SQLExpression<string>;
154
- /**
155
- * HTML unescape string
156
- * @param col - Column or expression to unescape
157
- */
158
36
  export declare function htmlUnescape(col: Expr): SQLExpression<string>;
159
- /**
160
- * Format number with specified decimal places
161
- * @param col - Column or expression to format
162
- * @param precision - Number of decimal places
163
- */
164
37
  export declare function formatDecimal(col: Expr, precision: number): SQLExpression<string>;
165
- /**
166
- * Format number in human-readable format
167
- * @param col - Column or expression to format
168
- * @param precision - Number of decimal places
169
- */
170
38
  export declare function formatReadableDecimal(col: Expr, precision: number): SQLExpression<string>;
171
- /**
172
- * Format number with specified number of digits
173
- * @param col - Column or expression to format
174
- * @param digits - Total number of digits
175
- */
176
39
  export declare function formatNumber(col: Expr, digits: number): SQLExpression<string>;
177
- /**
178
- * Format bytes in human-readable format
179
- * @param col - Column or expression to format
180
- * @param precision - Number of decimal places
181
- */
182
40
  export declare function formatBytes(col: Expr, precision?: number): SQLExpression<string>;
183
- /**
184
- * Format percentage
185
- * @param col - Column or expression to format
186
- * @param precision - Number of decimal places
187
- */
188
41
  export declare function formatPercentage(col: Expr, precision?: number): SQLExpression<string>;
189
42
  export {};
@@ -0,0 +1,109 @@
1
+ import { sql } from '../expressions';
2
+ export function toString(col) {
3
+ return sql `toString(${col})`;
4
+ }
5
+ export function toInt32(col) {
6
+ return sql `toInt32(${col})`;
7
+ }
8
+ export const toInteger = toInt32;
9
+ export function toInt64(col) {
10
+ return sql `toInt64(${col})`;
11
+ }
12
+ export function toUInt32(col) {
13
+ return sql `toUInt32(${col})`;
14
+ }
15
+ export function toUInt64(col) {
16
+ return sql `toUInt64(${col})`;
17
+ }
18
+ export function toFloat32(col) {
19
+ return sql `toFloat32(${col})`;
20
+ }
21
+ export function toFloat64(col) {
22
+ return sql `toFloat64(${col})`;
23
+ }
24
+ export function toBool(col) {
25
+ return sql `toBool(${col})`;
26
+ }
27
+ export const toBoolean = toBool;
28
+ export function toUUID(col) {
29
+ return sql `toUUID(${col})`;
30
+ }
31
+ export function toDate(col) {
32
+ return sql `toDate(${col})`;
33
+ }
34
+ export function toDateTime(col) {
35
+ return sql `toDateTime(${col})`;
36
+ }
37
+ export const toTimestamp = toDateTime;
38
+ export function toDateTime64(col, precision = 3) {
39
+ return sql `toDateTime64(${col}, ${precision})`;
40
+ }
41
+ export function toLowercase(col) {
42
+ return sql `toLowercase(${col})`;
43
+ }
44
+ export function toUppercase(col) {
45
+ return sql `toUppercase(${col})`;
46
+ }
47
+ export function toTitleCase(col) {
48
+ return sql `toTitleCase(${col})`;
49
+ }
50
+ export function convertTrim(col) {
51
+ return sql `trim(${col})`;
52
+ }
53
+ export function convertTrimLeft(col) {
54
+ return sql `trimLeft(${col})`;
55
+ }
56
+ export function convertTrimRight(col) {
57
+ return sql `trimRight(${col})`;
58
+ }
59
+ export function leftPad(col, length, fill = ' ') {
60
+ return sql `leftPad(${col}, ${length}, ${fill})`;
61
+ }
62
+ export function rightPad(col, length, fill = ' ') {
63
+ return sql `rightPad(${col}, ${length}, ${fill})`;
64
+ }
65
+ export function toHex(col) {
66
+ return sql `toHex(${col})`;
67
+ }
68
+ export function fromHex(col) {
69
+ return sql `fromHex(${col})`;
70
+ }
71
+ export function toBase64(col) {
72
+ return sql `toBase64(${col})`;
73
+ }
74
+ export function fromBase64(col) {
75
+ return sql `fromBase64(${col})`;
76
+ }
77
+ export function toBin(col) {
78
+ return sql `toBin(${col})`;
79
+ }
80
+ export function fromBin(col) {
81
+ return sql `fromBin(${col})`;
82
+ }
83
+ export function urlEncode(col) {
84
+ return sql `urlEncode(${col})`;
85
+ }
86
+ export function urlDecode(col) {
87
+ return sql `urlDecode(${col})`;
88
+ }
89
+ export function htmlEscape(col) {
90
+ return sql `htmlEscape(${col})`;
91
+ }
92
+ export function htmlUnescape(col) {
93
+ return sql `htmlUnescape(${col})`;
94
+ }
95
+ export function formatDecimal(col, precision) {
96
+ return sql `formatDecimal(${col}, ${precision})`;
97
+ }
98
+ export function formatReadableDecimal(col, precision) {
99
+ return sql `formatReadableDecimal(${col}, ${precision})`;
100
+ }
101
+ export function formatNumber(col, digits) {
102
+ return sql `formatNumber(${col}, ${digits})`;
103
+ }
104
+ export function formatBytes(col, precision = 2) {
105
+ return sql `formatBytes(${col}, ${precision})`;
106
+ }
107
+ export function formatPercentage(col, precision = 2) {
108
+ return sql `formatPercentage(${col}, ${precision})`;
109
+ }
@@ -1,202 +1,38 @@
1
1
  import { ClickHouseColumn } from '../core';
2
2
  import { SQLExpression } from '../expressions';
3
- /**
4
- * Calculate great circle distance between two points using Haversine formula
5
- * @param point1 - First point (longitude, latitude)
6
- * @param point2 - Second point (longitude, latitude)
7
- * @param unit - Distance unit ('km' or 'mi')
8
- */
9
3
  export declare function geoDistance(point1: ClickHouseColumn | SQLExpression, point2: ClickHouseColumn | SQLExpression, unit?: 'km' | 'mi'): SQLExpression;
10
- /**
11
- * Calculate great circle distance between two points (ClickHouse native)
12
- * @param point1 - First point (longitude, latitude)
13
- * @param point2 - Second point (longitude, latitude)
14
- */
15
4
  export declare function greatCircleDistance(point1: ClickHouseColumn | SQLExpression, point2: ClickHouseColumn | SQLExpression): SQLExpression;
16
- /**
17
- * Calculate distance between two points using Euclidean distance
18
- * @param point1 - First point (x, y)
19
- * @param point2 - Second point (x, y)
20
- */
21
5
  export declare function euclideanDistance(point1: ClickHouseColumn | SQLExpression, point2: ClickHouseColumn | SQLExpression): SQLExpression;
22
- /**
23
- * Calculate Manhattan distance between two points
24
- * @param point1 - First point (x, y)
25
- * @param point2 - Second point (x, y)
26
- */
27
6
  export declare function manhattanDistance(point1: ClickHouseColumn | SQLExpression, point2: ClickHouseColumn | SQLExpression): SQLExpression;
28
- /**
29
- * Create a point from longitude and latitude
30
- * @param longitude - Longitude coordinate
31
- * @param latitude - Latitude coordinate
32
- */
33
7
  export declare function geoPoint(longitude: ClickHouseColumn | SQLExpression | number, latitude: ClickHouseColumn | SQLExpression | number): SQLExpression;
34
- /**
35
- * Extract longitude from point
36
- * @param point - Point column or expression
37
- */
38
8
  export declare function geoLongitude(point: ClickHouseColumn | SQLExpression): SQLExpression;
39
- /**
40
- * Extract latitude from point
41
- * @param point - Point column or expression
42
- */
43
9
  export declare function geoLatitude(point: ClickHouseColumn | SQLExpression): SQLExpression;
44
- /**
45
- * Extract x coordinate from point
46
- * @param point - Point column or expression
47
- */
48
10
  export declare function geoX(point: ClickHouseColumn | SQLExpression): SQLExpression;
49
- /**
50
- * Extract y coordinate from point
51
- * @param point - Point column or expression
52
- */
53
11
  export declare function geoY(point: ClickHouseColumn | SQLExpression): SQLExpression;
54
- /**
55
- * Check if point is within polygon
56
- * @param point - Point to check
57
- * @param polygon - Polygon to check against
58
- */
59
12
  export declare function pointInPolygon(point: ClickHouseColumn | SQLExpression, polygon: ClickHouseColumn | SQLExpression): SQLExpression;
60
- /**
61
- * Check if polygon contains another polygon
62
- * @param polygon1 - First polygon
63
- * @param polygon2 - Second polygon
64
- */
65
13
  export declare function polygonContains(polygon1: ClickHouseColumn | SQLExpression, polygon2: ClickHouseColumn | SQLExpression): SQLExpression;
66
- /**
67
- * Check if two polygons intersect
68
- * @param polygon1 - First polygon
69
- * @param polygon2 - Second polygon
70
- */
71
14
  export declare function polygonsIntersect(polygon1: ClickHouseColumn | SQLExpression, polygon2: ClickHouseColumn | SQLExpression): SQLExpression;
72
- /**
73
- * Create a bounding box from two points (bottom-left and top-right)
74
- * @param point1 - Bottom-left point
75
- * @param point2 - Top-right point
76
- */
77
15
  export declare function boundingBox(point1: ClickHouseColumn | SQLExpression, point2: ClickHouseColumn | SQLExpression): SQLExpression;
78
- /**
79
- * Check if point is within bounding box
80
- * @param point - Point to check
81
- * @param bbox - Bounding box
82
- */
83
16
  export declare function pointInBoundingBox(point: ClickHouseColumn | SQLExpression, bbox: ClickHouseColumn | SQLExpression): SQLExpression;
84
- /**
85
- * Get the minimum point of a bounding box
86
- * @param bbox - Bounding box
87
- */
88
17
  export declare function bboxMin(bbox: ClickHouseColumn | SQLExpression): SQLExpression;
89
- /**
90
- * Get the maximum point of a bounding box
91
- * @param bbox - Bounding box
92
- */
93
18
  export declare function bboxMax(bbox: ClickHouseColumn | SQLExpression): SQLExpression;
94
- /**
95
- * Calculate area of a polygon
96
- * @param polygon - Polygon column or expression
97
- */
98
19
  export declare function polygonArea(polygon: ClickHouseColumn | SQLExpression): SQLExpression;
99
- /**
100
- * Calculate perimeter of a polygon
101
- * @param polygon - Polygon column or expression
102
- */
103
20
  export declare function polygonPerimeter(polygon: ClickHouseColumn | SQLExpression): SQLExpression;
104
- /**
105
- * Get the centroid of a polygon
106
- * @param polygon - Polygon column or expression
107
- */
108
21
  export declare function polygonCentroid(polygon: ClickHouseColumn | SQLExpression): SQLExpression;
109
- /**
110
- * Simplify a polygon (reduce number of points)
111
- * @param polygon - Polygon to simplify
112
- * @param epsilon - Simplification tolerance
113
- */
114
22
  export declare function polygonSimplify(polygon: ClickHouseColumn | SQLExpression, epsilon: number): SQLExpression;
115
- /**
116
- * Buffer a polygon (expand/contract by distance)
117
- * @param polygon - Polygon to buffer
118
- * @param distance - Buffer distance
119
- */
120
23
  export declare function polygonBuffer(polygon: ClickHouseColumn | SQLExpression, distance: number): SQLExpression;
121
- /**
122
- * Encode a point as geohash
123
- * @param point - Point to encode
124
- * @param precision - Geohash precision (1-12)
125
- */
126
24
  export declare function geoHashEncode(point: ClickHouseColumn | SQLExpression, precision?: number): SQLExpression;
127
- /**
128
- * Decode a geohash to a point
129
- * @param geohash - Geohash string to decode
130
- */
131
25
  export declare function geoHashDecode(geohash: ClickHouseColumn | SQLExpression): SQLExpression;
132
- /**
133
- * Get neighbors of a geohash
134
- * @param geohash - Geohash string
135
- */
136
26
  export declare function geoHashNeighbors(geohash: ClickHouseColumn | SQLExpression): SQLExpression;
137
- /**
138
- * Check if two geohashes are neighbors
139
- * @param geohash1 - First geohash
140
- * @param geohash2 - Second geohash
141
- */
142
27
  export declare function geoHashAreNeighbors(geohash1: ClickHouseColumn | SQLExpression, geohash2: ClickHouseColumn | SQLExpression): SQLExpression;
143
- /**
144
- * Find points within radius of a center point
145
- * @param center - Center point
146
- * @param radius - Search radius
147
- * @param points - Points to search
148
- */
149
28
  export declare function pointsWithinRadius(center: ClickHouseColumn | SQLExpression, radius: number, points: ClickHouseColumn | SQLExpression): SQLExpression;
150
- /**
151
- * Find nearest neighbors to a point
152
- * @param point - Reference point
153
- * @param points - Array of points to search
154
- * @param k - Number of neighbors to find
155
- */
156
29
  export declare function nearestNeighbors(point: ClickHouseColumn | SQLExpression, points: ClickHouseColumn | SQLExpression, k: number): SQLExpression;
157
- /**
158
- * Cluster points using k-means
159
- * @param points - Array of points to cluster
160
- * @param k - Number of clusters
161
- */
162
30
  export declare function kMeansClustering(points: ClickHouseColumn | SQLExpression, k: number): SQLExpression;
163
- /**
164
- * Convert degrees to radians
165
- * @param degrees - Degrees value
166
- */
167
31
  export declare function degreesToRadians(degrees: ClickHouseColumn | SQLExpression): SQLExpression;
168
- /**
169
- * Convert radians to degrees
170
- * @param radians - Radians value
171
- */
172
32
  export declare function radiansToDegrees(radians: ClickHouseColumn | SQLExpression): SQLExpression;
173
- /**
174
- * Convert Web Mercator to WGS84
175
- * @param point - Point in Web Mercator coordinates
176
- */
177
33
  export declare function webMercatorToWGS84(point: ClickHouseColumn | SQLExpression): SQLExpression;
178
- /**
179
- * Convert WGS84 to Web Mercator
180
- * @param point - Point in WGS84 coordinates
181
- */
182
34
  export declare function wGS84ToWebMercator(point: ClickHouseColumn | SQLExpression): SQLExpression;
183
- /**
184
- * Check if a geometry is valid
185
- * @param geometry - Geometry to validate
186
- */
187
35
  export declare function isValidGeometry(geometry: ClickHouseColumn | SQLExpression): SQLExpression;
188
- /**
189
- * Get the geometry type
190
- * @param geometry - Geometry column or expression
191
- */
192
36
  export declare function geometryType(geometry: ClickHouseColumn | SQLExpression): SQLExpression;
193
- /**
194
- * Get the number of points in a geometry
195
- * @param geometry - Geometry column or expression
196
- */
197
37
  export declare function geometryNumPoints(geometry: ClickHouseColumn | SQLExpression): SQLExpression;
198
- /**
199
- * Get the number of interior rings in a polygon
200
- * @param polygon - Polygon column or expression
201
- */
202
38
  export declare function polygonNumInteriorRings(polygon: ClickHouseColumn | SQLExpression): SQLExpression;