@expo/entity-database-adapter-knex 0.61.0 → 0.63.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/build/src/AuthorizationResultBasedKnexEntityLoader.d.ts +0 -8
- package/build/src/AuthorizationResultBasedKnexEntityLoader.js +0 -11
- package/build/src/BasePostgresEntityDatabaseAdapter.d.ts +0 -11
- package/build/src/BasePostgresEntityDatabaseAdapter.js +0 -13
- package/build/src/EnforcingKnexEntityLoader.d.ts +0 -32
- package/build/src/EnforcingKnexEntityLoader.js +0 -35
- package/build/src/PostgresEntityDatabaseAdapter.d.ts +3 -2
- package/build/src/PostgresEntityDatabaseAdapter.js +2 -6
- package/build/src/SQLOperator.d.ts +379 -31
- package/build/src/internal/EntityKnexDataManager.d.ts +0 -10
- package/build/src/internal/EntityKnexDataManager.js +3 -16
- package/package.json +5 -5
- package/src/AuthorizationResultBasedKnexEntityLoader.ts +0 -21
- package/src/BasePostgresEntityDatabaseAdapter.ts +0 -36
- package/src/EnforcingKnexEntityLoader.ts +0 -44
- package/src/PostgresEntityDatabaseAdapter.ts +4 -15
- package/src/SQLOperator.ts +449 -101
- package/src/__integration-tests__/PostgresEntityIntegration-test.ts +69 -116
- package/src/__tests__/AuthorizationResultBasedKnexEntityLoader-test.ts +0 -75
- package/src/__tests__/BasePostgresEntityDatabaseAdapter-test.ts +4 -28
- package/src/__tests__/EnforcingKnexEntityLoader-test.ts +0 -52
- package/src/__tests__/fixtures/StubPostgresDatabaseAdapter.ts +3 -13
- package/src/internal/EntityKnexDataManager.ts +6 -37
- package/src/internal/__tests__/EntityKnexDataManager-test.ts +1 -57
|
@@ -235,14 +235,6 @@ export declare class AuthorizationResultBasedKnexEntityLoader<TFields extends Re
|
|
|
235
235
|
* @returns array of entity results that match the query, where result error can be UnauthorizedError
|
|
236
236
|
*/
|
|
237
237
|
loadManyByFieldEqualityConjunctionAsync<N extends keyof Pick<TFields, TSelectedFields>>(fieldEqualityOperands: readonly FieldEqualityCondition<TFields, N>[], querySelectionModifiers?: EntityLoaderQuerySelectionModifiers<TFields, TSelectedFields>): Promise<readonly Result<TEntity>[]>;
|
|
238
|
-
/**
|
|
239
|
-
* Authorization-result-based version of the EnforcingKnexEntityLoader method by the same name.
|
|
240
|
-
* @returns array of entity results that match the query, where result error can be UnauthorizedError
|
|
241
|
-
* @throws Error when rawWhereClause or bindings are invalid
|
|
242
|
-
*
|
|
243
|
-
* @deprecated Use loadManyBySQL instead for safer value bindings and more flexible query building.
|
|
244
|
-
*/
|
|
245
|
-
loadManyByRawWhereClauseAsync(rawWhereClause: string, bindings: any[] | object, querySelectionModifiers?: EntityLoaderQuerySelectionModifiers<TFields, TSelectedFields>): Promise<readonly Result<TEntity>[]>;
|
|
246
238
|
/**
|
|
247
239
|
* Authorization-result-based version of the EnforcingKnexEntityLoader method by the same name.
|
|
248
240
|
* @returns SQL query builder for building and executing SQL queries that when executed returns entity results where result error can be UnauthorizedError.
|
|
@@ -43,17 +43,6 @@ export class AuthorizationResultBasedKnexEntityLoader {
|
|
|
43
43
|
const fieldObjects = await this.knexDataManager.loadManyByFieldEqualityConjunctionAsync(this.queryContext, fieldEqualityOperands, querySelectionModifiers);
|
|
44
44
|
return await this.constructionUtils.constructAndAuthorizeEntitiesArrayAsync(fieldObjects);
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Authorization-result-based version of the EnforcingKnexEntityLoader method by the same name.
|
|
48
|
-
* @returns array of entity results that match the query, where result error can be UnauthorizedError
|
|
49
|
-
* @throws Error when rawWhereClause or bindings are invalid
|
|
50
|
-
*
|
|
51
|
-
* @deprecated Use loadManyBySQL instead for safer value bindings and more flexible query building.
|
|
52
|
-
*/
|
|
53
|
-
async loadManyByRawWhereClauseAsync(rawWhereClause, bindings, querySelectionModifiers = {}) {
|
|
54
|
-
const fieldObjects = await this.knexDataManager.loadManyByRawWhereClauseAsync(this.queryContext, rawWhereClause, bindings, querySelectionModifiers);
|
|
55
|
-
return await this.constructionUtils.constructAndAuthorizeEntitiesArrayAsync(fieldObjects);
|
|
56
|
-
}
|
|
57
46
|
/**
|
|
58
47
|
* Authorization-result-based version of the EnforcingKnexEntityLoader method by the same name.
|
|
59
48
|
* @returns SQL query builder for building and executing SQL queries that when executed returns entity results where result error can be UnauthorizedError.
|
|
@@ -126,17 +126,6 @@ export declare abstract class BasePostgresEntityDatabaseAdapter<TFields extends
|
|
|
126
126
|
*/
|
|
127
127
|
fetchManyByFieldEqualityConjunctionAsync<N extends keyof TFields>(queryContext: EntityQueryContext, fieldEqualityOperands: readonly FieldEqualityCondition<TFields, N>[], querySelectionModifiers: PostgresQuerySelectionModifiers<TFields>): Promise<readonly Readonly<TFields>[]>;
|
|
128
128
|
protected abstract fetchManyByFieldEqualityConjunctionInternalAsync(queryInterface: Knex, tableName: string, tableFieldSingleValueEqualityOperands: TableFieldSingleValueEqualityCondition[], tableFieldMultiValueEqualityOperands: TableFieldMultiValueEqualityCondition[], querySelectionModifiers: TableQuerySelectionModifiers<TFields>): Promise<object[]>;
|
|
129
|
-
/**
|
|
130
|
-
* Fetch many objects matching the raw WHERE clause.
|
|
131
|
-
*
|
|
132
|
-
* @param queryContext - query context with which to perform the fetch
|
|
133
|
-
* @param rawWhereClause - parameterized SQL WHERE clause with positional binding placeholders or named binding placeholders
|
|
134
|
-
* @param bindings - array of positional bindings or object of named bindings
|
|
135
|
-
* @param querySelectionModifiers - limit, offset, and orderBy for the query
|
|
136
|
-
* @returns array of objects matching the query
|
|
137
|
-
*/
|
|
138
|
-
fetchManyByRawWhereClauseAsync(queryContext: EntityQueryContext, rawWhereClause: string, bindings: any[] | object, querySelectionModifiers: PostgresQuerySelectionModifiers<TFields>): Promise<readonly Readonly<TFields>[]>;
|
|
139
|
-
protected abstract fetchManyByRawWhereClauseInternalAsync(queryInterface: Knex, tableName: string, rawWhereClause: string, bindings: object | any[], querySelectionModifiers: TableQuerySelectionModifiers<TFields>): Promise<object[]>;
|
|
140
129
|
/**
|
|
141
130
|
* Fetch many objects matching the SQL fragment.
|
|
142
131
|
*
|
|
@@ -60,19 +60,6 @@ export class BasePostgresEntityDatabaseAdapter extends EntityDatabaseAdapter {
|
|
|
60
60
|
const results = await this.fetchManyByFieldEqualityConjunctionInternalAsync(queryContext.getQueryInterface(), this.entityConfiguration.tableName, tableFieldSingleValueOperands, tableFieldMultipleValueOperands, this.convertToTableQueryModifiers(querySelectionModifiers));
|
|
61
61
|
return results.map((result) => transformDatabaseObjectToFields(this.entityConfiguration, this.fieldTransformerMap, result));
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Fetch many objects matching the raw WHERE clause.
|
|
65
|
-
*
|
|
66
|
-
* @param queryContext - query context with which to perform the fetch
|
|
67
|
-
* @param rawWhereClause - parameterized SQL WHERE clause with positional binding placeholders or named binding placeholders
|
|
68
|
-
* @param bindings - array of positional bindings or object of named bindings
|
|
69
|
-
* @param querySelectionModifiers - limit, offset, and orderBy for the query
|
|
70
|
-
* @returns array of objects matching the query
|
|
71
|
-
*/
|
|
72
|
-
async fetchManyByRawWhereClauseAsync(queryContext, rawWhereClause, bindings, querySelectionModifiers) {
|
|
73
|
-
const results = await this.fetchManyByRawWhereClauseInternalAsync(queryContext.getQueryInterface(), this.entityConfiguration.tableName, rawWhereClause, bindings, this.convertToTableQueryModifiers(querySelectionModifiers));
|
|
74
|
-
return results.map((result) => transformDatabaseObjectToFields(this.entityConfiguration, this.fieldTransformerMap, result));
|
|
75
|
-
}
|
|
76
63
|
/**
|
|
77
64
|
* Fetch many objects matching the SQL fragment.
|
|
78
65
|
*
|
|
@@ -38,38 +38,6 @@ export declare class EnforcingKnexEntityLoader<TFields extends Record<string, an
|
|
|
38
38
|
* @returns entities matching the filters
|
|
39
39
|
*/
|
|
40
40
|
loadManyByFieldEqualityConjunctionAsync<N extends keyof Pick<TFields, TSelectedFields>>(fieldEqualityOperands: FieldEqualityCondition<TFields, N>[], querySelectionModifiers?: EntityLoaderQuerySelectionModifiers<TFields, TSelectedFields>): Promise<readonly TEntity[]>;
|
|
41
|
-
/**
|
|
42
|
-
* Load entities with a raw SQL WHERE clause.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* Load entities with SQL function
|
|
46
|
-
* ```typescript
|
|
47
|
-
* const entitiesWithJsonKey = await ExampleEntity.loader(vc)
|
|
48
|
-
* .loadManyByRawWhereClauseAsync(
|
|
49
|
-
* "json_column->>'key_name' = ?",
|
|
50
|
-
* ['value'],
|
|
51
|
-
* );
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* Load entities with tuple matching
|
|
56
|
-
* ```typescript
|
|
57
|
-
* const entities = await ExampleEntity.loader(vc)
|
|
58
|
-
* .loadManyByRawWhereClauseAsync(
|
|
59
|
-
* '(column_1, column_2) IN ((?, ?), (?, ?))',
|
|
60
|
-
* [value1, value2, value3, value4],
|
|
61
|
-
* );
|
|
62
|
-
* ```
|
|
63
|
-
* @param rawWhereClause - SQL WHERE clause. Interpolated values should be specified as ?-placeholders or :key_name
|
|
64
|
-
* @param bindings - values to bind to the placeholders in the WHERE clause
|
|
65
|
-
* @param querySelectionModifiers - limit, offset, and orderBy for the query.
|
|
66
|
-
* @returns entities matching the WHERE clause
|
|
67
|
-
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
68
|
-
* @throws Error when rawWhereClause or bindings are invalid
|
|
69
|
-
*
|
|
70
|
-
* @deprecated Use loadManyBySQL instead for safer value bindings and more flexible query building.
|
|
71
|
-
*/
|
|
72
|
-
loadManyByRawWhereClauseAsync(rawWhereClause: string, bindings: any[] | object, querySelectionModifiers?: EntityLoaderQuerySelectionModifiers<TFields, TSelectedFields>): Promise<readonly TEntity[]>;
|
|
73
41
|
/**
|
|
74
42
|
* Load entities using a SQL query builder. When executed, all queries will enforce authorization and throw if not authorized.
|
|
75
43
|
*
|
|
@@ -45,41 +45,6 @@ export class EnforcingKnexEntityLoader {
|
|
|
45
45
|
const entityResults = await this.knexEntityLoader.loadManyByFieldEqualityConjunctionAsync(fieldEqualityOperands, querySelectionModifiers);
|
|
46
46
|
return entityResults.map((result) => result.enforceValue());
|
|
47
47
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Load entities with a raw SQL WHERE clause.
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* Load entities with SQL function
|
|
53
|
-
* ```typescript
|
|
54
|
-
* const entitiesWithJsonKey = await ExampleEntity.loader(vc)
|
|
55
|
-
* .loadManyByRawWhereClauseAsync(
|
|
56
|
-
* "json_column->>'key_name' = ?",
|
|
57
|
-
* ['value'],
|
|
58
|
-
* );
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* Load entities with tuple matching
|
|
63
|
-
* ```typescript
|
|
64
|
-
* const entities = await ExampleEntity.loader(vc)
|
|
65
|
-
* .loadManyByRawWhereClauseAsync(
|
|
66
|
-
* '(column_1, column_2) IN ((?, ?), (?, ?))',
|
|
67
|
-
* [value1, value2, value3, value4],
|
|
68
|
-
* );
|
|
69
|
-
* ```
|
|
70
|
-
* @param rawWhereClause - SQL WHERE clause. Interpolated values should be specified as ?-placeholders or :key_name
|
|
71
|
-
* @param bindings - values to bind to the placeholders in the WHERE clause
|
|
72
|
-
* @param querySelectionModifiers - limit, offset, and orderBy for the query.
|
|
73
|
-
* @returns entities matching the WHERE clause
|
|
74
|
-
* @throws EntityNotAuthorizedError when viewer is not authorized to view one or more of the returned entities
|
|
75
|
-
* @throws Error when rawWhereClause or bindings are invalid
|
|
76
|
-
*
|
|
77
|
-
* @deprecated Use loadManyBySQL instead for safer value bindings and more flexible query building.
|
|
78
|
-
*/
|
|
79
|
-
async loadManyByRawWhereClauseAsync(rawWhereClause, bindings, querySelectionModifiers = {}) {
|
|
80
|
-
const entityResults = await this.knexEntityLoader.loadManyByRawWhereClauseAsync(rawWhereClause, bindings, querySelectionModifiers);
|
|
81
|
-
return entityResults.map((result) => result.enforceValue());
|
|
82
|
-
}
|
|
83
48
|
/**
|
|
84
49
|
* Load entities using a SQL query builder. When executed, all queries will enforce authorization and throw if not authorized.
|
|
85
50
|
*
|
|
@@ -13,9 +13,10 @@ export declare class PostgresEntityDatabaseAdapter<TFields extends Record<string
|
|
|
13
13
|
protected fetchOneWhereInternalAsync(queryInterface: Knex, tableName: string, tableColumns: readonly string[], tableTuple: readonly any[]): Promise<object | null>;
|
|
14
14
|
private applyQueryModifiersToQuery;
|
|
15
15
|
protected fetchManyByFieldEqualityConjunctionInternalAsync(queryInterface: Knex, tableName: string, tableFieldSingleValueEqualityOperands: TableFieldSingleValueEqualityCondition[], tableFieldMultiValueEqualityOperands: TableFieldMultiValueEqualityCondition[], querySelectionModifiers: TableQuerySelectionModifiers<TFields>): Promise<object[]>;
|
|
16
|
-
protected fetchManyByRawWhereClauseInternalAsync(queryInterface: Knex, tableName: string, rawWhereClause: string, bindings: object | any[], querySelectionModifiers: TableQuerySelectionModifiers<TFields>): Promise<object[]>;
|
|
17
16
|
protected fetchManyBySQLFragmentInternalAsync(queryInterface: Knex, tableName: string, sqlFragment: SQLFragment<TFields>, querySelectionModifiers: TableQuerySelectionModifiers<TFields>): Promise<object[]>;
|
|
18
17
|
protected insertInternalAsync(queryInterface: Knex, tableName: string, object: object): Promise<object[]>;
|
|
19
|
-
protected updateInternalAsync(queryInterface: Knex, tableName: string, tableIdField: string, id: any, object: object): Promise<
|
|
18
|
+
protected updateInternalAsync(queryInterface: Knex, tableName: string, tableIdField: string, id: any, object: object): Promise<{
|
|
19
|
+
updatedRowCount: number;
|
|
20
|
+
}>;
|
|
20
21
|
protected deleteInternalAsync(queryInterface: Knex, tableName: string, tableIdField: string, id: any): Promise<number>;
|
|
21
22
|
}
|
|
@@ -133,11 +133,6 @@ export class PostgresEntityDatabaseAdapter extends BasePostgresEntityDatabaseAda
|
|
|
133
133
|
query = this.applyQueryModifiersToQuery(query, querySelectionModifiers);
|
|
134
134
|
return await wrapNativePostgresCallAsync(() => query);
|
|
135
135
|
}
|
|
136
|
-
async fetchManyByRawWhereClauseInternalAsync(queryInterface, tableName, rawWhereClause, bindings, querySelectionModifiers) {
|
|
137
|
-
let query = queryInterface.select().from(tableName).whereRaw(rawWhereClause, bindings);
|
|
138
|
-
query = this.applyQueryModifiersToQuery(query, querySelectionModifiers);
|
|
139
|
-
return await wrapNativePostgresCallAsync(() => query);
|
|
140
|
-
}
|
|
141
136
|
async fetchManyBySQLFragmentInternalAsync(queryInterface, tableName, sqlFragment, querySelectionModifiers) {
|
|
142
137
|
let query = queryInterface
|
|
143
138
|
.select()
|
|
@@ -150,7 +145,8 @@ export class PostgresEntityDatabaseAdapter extends BasePostgresEntityDatabaseAda
|
|
|
150
145
|
return await wrapNativePostgresCallAsync(() => queryInterface.insert(object).into(tableName).returning('*'));
|
|
151
146
|
}
|
|
152
147
|
async updateInternalAsync(queryInterface, tableName, tableIdField, id, object) {
|
|
153
|
-
|
|
148
|
+
const updatedRowCount = await wrapNativePostgresCallAsync(() => queryInterface.update(object).into(tableName).where(tableIdField, id));
|
|
149
|
+
return { updatedRowCount };
|
|
154
150
|
}
|
|
155
151
|
async deleteInternalAsync(queryInterface, tableName, tableIdField, id) {
|
|
156
152
|
return await wrapNativePostgresCallAsync(() => queryInterface.into(tableName).where(tableIdField, id).del());
|
|
@@ -311,63 +311,411 @@ declare const ALLOWED_CAST_TYPES: readonly ["int", "integer", "int2", "int4", "i
|
|
|
311
311
|
* Only these types can be used to prevent SQL injection through type name interpolation.
|
|
312
312
|
*/
|
|
313
313
|
export type PostgresCastType = (typeof ALLOWED_CAST_TYPES)[number];
|
|
314
|
-
type
|
|
315
|
-
type
|
|
316
|
-
type
|
|
317
|
-
type
|
|
318
|
-
|
|
314
|
+
type ExtractFragmentFields<T> = T extends SQLFragment<infer F> ? F : never;
|
|
315
|
+
type FragmentValueNullable<TFragment> = TFragment extends SQLChainableFragment<any, infer TValue> ? TValue | null | undefined : SupportedSQLValue;
|
|
316
|
+
type FragmentValue<TFragment> = TFragment extends SQLChainableFragment<any, infer TValue> ? TValue : SupportedSQLValue;
|
|
317
|
+
type FragmentValueArray<TFragment> = TFragment extends SQLChainableFragment<any, infer TValue> ? readonly TValue[] : readonly SupportedSQLValue[];
|
|
318
|
+
/**
|
|
319
|
+
* Generates an `IN (...)` condition from a fragment and array of values.
|
|
320
|
+
* Each array element becomes a separate bound parameter. Returns `FALSE` for empty arrays.
|
|
321
|
+
*
|
|
322
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
323
|
+
* @param values - The values to check membership against
|
|
324
|
+
*/
|
|
325
|
+
declare function inArrayHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, values: FragmentValueArray<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
326
|
+
/**
|
|
327
|
+
* Generates an `IN (...)` condition from a field name and array of values.
|
|
328
|
+
* Each array element becomes a separate bound parameter. Returns `FALSE` for empty arrays.
|
|
329
|
+
*
|
|
330
|
+
* @param fieldName - The entity field name to check
|
|
331
|
+
* @param values - The values to check membership against
|
|
332
|
+
*/
|
|
319
333
|
declare function inArrayHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, values: readonly TFields[N][]): SQLFragment<TFields>;
|
|
320
|
-
|
|
334
|
+
/**
|
|
335
|
+
* Generates an `= ANY(?)` condition from a fragment and array of values.
|
|
336
|
+
* The array is bound as a single parameter for consistent query shape. Returns `FALSE` for empty arrays.
|
|
337
|
+
*
|
|
338
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
339
|
+
* @param values - The values to check membership against
|
|
340
|
+
*/
|
|
341
|
+
declare function anyArrayHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, values: FragmentValueArray<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
342
|
+
/**
|
|
343
|
+
* Generates an `= ANY(?)` condition from a field name and array of values.
|
|
344
|
+
* The array is bound as a single parameter for consistent query shape. Returns `FALSE` for empty arrays.
|
|
345
|
+
*
|
|
346
|
+
* @param fieldName - The entity field name to check
|
|
347
|
+
* @param values - The values to check membership against
|
|
348
|
+
*/
|
|
321
349
|
declare function anyArrayHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, values: readonly TFields[N][]): SQLFragment<TFields>;
|
|
322
|
-
|
|
350
|
+
/**
|
|
351
|
+
* Generates a `NOT IN (...)` condition from a fragment and array of values.
|
|
352
|
+
* Each array element becomes a separate bound parameter. Returns `TRUE` for empty arrays.
|
|
353
|
+
*
|
|
354
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
355
|
+
* @param values - The values to check non-membership against
|
|
356
|
+
*/
|
|
357
|
+
declare function notInArrayHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, values: FragmentValueArray<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
358
|
+
/**
|
|
359
|
+
* Generates a `NOT IN (...)` condition from a field name and array of values.
|
|
360
|
+
* Each array element becomes a separate bound parameter. Returns `TRUE` for empty arrays.
|
|
361
|
+
*
|
|
362
|
+
* @param fieldName - The entity field name to check
|
|
363
|
+
* @param values - The values to check non-membership against
|
|
364
|
+
*/
|
|
323
365
|
declare function notInArrayHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, values: readonly TFields[N][]): SQLFragment<TFields>;
|
|
324
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Generates a `BETWEEN min AND max` condition (inclusive) from a fragment.
|
|
368
|
+
*
|
|
369
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
370
|
+
* @param min - The lower bound
|
|
371
|
+
* @param max - The upper bound
|
|
372
|
+
*/
|
|
373
|
+
declare function betweenHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, min: FragmentValue<TFragment>, max: FragmentValue<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
374
|
+
/**
|
|
375
|
+
* Generates a `BETWEEN min AND max` condition (inclusive) from a field name.
|
|
376
|
+
*
|
|
377
|
+
* @param fieldName - The entity field name to check
|
|
378
|
+
* @param min - The lower bound
|
|
379
|
+
* @param max - The upper bound
|
|
380
|
+
*/
|
|
325
381
|
declare function betweenHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, min: TFields[N], max: TFields[N]): SQLFragment<TFields>;
|
|
326
|
-
|
|
382
|
+
/**
|
|
383
|
+
* Generates a `NOT BETWEEN min AND max` condition from a fragment.
|
|
384
|
+
*
|
|
385
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
386
|
+
* @param min - The lower bound
|
|
387
|
+
* @param max - The upper bound
|
|
388
|
+
*/
|
|
389
|
+
declare function notBetweenHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, min: FragmentValue<TFragment>, max: FragmentValue<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
390
|
+
/**
|
|
391
|
+
* Generates a `NOT BETWEEN min AND max` condition from a field name.
|
|
392
|
+
*
|
|
393
|
+
* @param fieldName - The entity field name to check
|
|
394
|
+
* @param min - The lower bound
|
|
395
|
+
* @param max - The upper bound
|
|
396
|
+
*/
|
|
327
397
|
declare function notBetweenHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, min: TFields[N], max: TFields[N]): SQLFragment<TFields>;
|
|
328
|
-
|
|
398
|
+
/**
|
|
399
|
+
* Generates a case-sensitive `LIKE` condition from a fragment.
|
|
400
|
+
*
|
|
401
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to match
|
|
402
|
+
* @param pattern - The LIKE pattern (use `%` for wildcards, `_` for single character)
|
|
403
|
+
*/
|
|
404
|
+
declare function likeHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, pattern: string): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
405
|
+
/**
|
|
406
|
+
* Generates a case-sensitive `LIKE` condition from a field name.
|
|
407
|
+
*
|
|
408
|
+
* @param fieldName - The entity field name to match
|
|
409
|
+
* @param pattern - The LIKE pattern (use `%` for wildcards, `_` for single character)
|
|
410
|
+
*/
|
|
329
411
|
declare function likeHelper<TFields extends Record<string, any>, N extends PickStringValueKeys<TFields>>(fieldName: N, pattern: string): SQLFragment<TFields>;
|
|
330
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Generates a case-sensitive `NOT LIKE` condition from a fragment.
|
|
414
|
+
*
|
|
415
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to match
|
|
416
|
+
* @param pattern - The LIKE pattern (use `%` for wildcards, `_` for single character)
|
|
417
|
+
*/
|
|
418
|
+
declare function notLikeHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, pattern: string): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
419
|
+
/**
|
|
420
|
+
* Generates a case-sensitive `NOT LIKE` condition from a field name.
|
|
421
|
+
*
|
|
422
|
+
* @param fieldName - The entity field name to match
|
|
423
|
+
* @param pattern - The LIKE pattern (use `%` for wildcards, `_` for single character)
|
|
424
|
+
*/
|
|
331
425
|
declare function notLikeHelper<TFields extends Record<string, any>, N extends PickStringValueKeys<TFields>>(fieldName: N, pattern: string): SQLFragment<TFields>;
|
|
332
|
-
|
|
426
|
+
/**
|
|
427
|
+
* Generates a case-insensitive `ILIKE` condition from a fragment (PostgreSQL-specific).
|
|
428
|
+
*
|
|
429
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to match
|
|
430
|
+
* @param pattern - The LIKE pattern (use `%` for wildcards, `_` for single character)
|
|
431
|
+
*/
|
|
432
|
+
declare function ilikeHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, pattern: string): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
433
|
+
/**
|
|
434
|
+
* Generates a case-insensitive `ILIKE` condition from a field name (PostgreSQL-specific).
|
|
435
|
+
*
|
|
436
|
+
* @param fieldName - The entity field name to match
|
|
437
|
+
* @param pattern - The LIKE pattern (use `%` for wildcards, `_` for single character)
|
|
438
|
+
*/
|
|
333
439
|
declare function ilikeHelper<TFields extends Record<string, any>, N extends PickStringValueKeys<TFields>>(fieldName: N, pattern: string): SQLFragment<TFields>;
|
|
334
|
-
|
|
440
|
+
/**
|
|
441
|
+
* Generates a case-insensitive `NOT ILIKE` condition from a fragment (PostgreSQL-specific).
|
|
442
|
+
*
|
|
443
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to match
|
|
444
|
+
* @param pattern - The LIKE pattern (use `%` for wildcards, `_` for single character)
|
|
445
|
+
*/
|
|
446
|
+
declare function notIlikeHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, pattern: string): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
447
|
+
/**
|
|
448
|
+
* Generates a case-insensitive `NOT ILIKE` condition from a field name (PostgreSQL-specific).
|
|
449
|
+
*
|
|
450
|
+
* @param fieldName - The entity field name to match
|
|
451
|
+
* @param pattern - The LIKE pattern (use `%` for wildcards, `_` for single character)
|
|
452
|
+
*/
|
|
335
453
|
declare function notIlikeHelper<TFields extends Record<string, any>, N extends PickStringValueKeys<TFields>>(fieldName: N, pattern: string): SQLFragment<TFields>;
|
|
336
|
-
|
|
454
|
+
/**
|
|
455
|
+
* Generates an `IS NULL` condition from a fragment.
|
|
456
|
+
*
|
|
457
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
458
|
+
*/
|
|
459
|
+
declare function isNullHelper<TFragment extends SQLFragment<any>>(fragment: TFragment): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
460
|
+
/**
|
|
461
|
+
* Generates an `IS NULL` condition from a field name.
|
|
462
|
+
*
|
|
463
|
+
* @param fieldName - The entity field name to check
|
|
464
|
+
*/
|
|
337
465
|
declare function isNullHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N): SQLFragment<TFields>;
|
|
338
|
-
|
|
466
|
+
/**
|
|
467
|
+
* Generates an `IS NOT NULL` condition from a fragment.
|
|
468
|
+
*
|
|
469
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
470
|
+
*/
|
|
471
|
+
declare function isNotNullHelper<TFragment extends SQLFragment<any>>(fragment: TFragment): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
472
|
+
/**
|
|
473
|
+
* Generates an `IS NOT NULL` condition from a field name.
|
|
474
|
+
*
|
|
475
|
+
* @param fieldName - The entity field name to check
|
|
476
|
+
*/
|
|
339
477
|
declare function isNotNullHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N): SQLFragment<TFields>;
|
|
340
|
-
|
|
478
|
+
/**
|
|
479
|
+
* Generates an equality condition (`= value`) from a fragment.
|
|
480
|
+
* Automatically converts `null`/`undefined` to `IS NULL`.
|
|
481
|
+
*
|
|
482
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to compare
|
|
483
|
+
* @param value - The value to compare against
|
|
484
|
+
*/
|
|
485
|
+
declare function eqHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, value: FragmentValueNullable<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
486
|
+
/**
|
|
487
|
+
* Generates an equality condition (`= value`) from a field name.
|
|
488
|
+
* Automatically converts `null`/`undefined` to `IS NULL`.
|
|
489
|
+
*
|
|
490
|
+
* @param fieldName - The entity field name to compare
|
|
491
|
+
* @param value - The value to compare against
|
|
492
|
+
*/
|
|
341
493
|
declare function eqHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, value: TFields[N]): SQLFragment<TFields>;
|
|
342
|
-
|
|
494
|
+
/**
|
|
495
|
+
* Generates an inequality condition (`!= value`) from a fragment.
|
|
496
|
+
* Automatically converts `null`/`undefined` to `IS NOT NULL`.
|
|
497
|
+
*
|
|
498
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to compare
|
|
499
|
+
* @param value - The value to compare against
|
|
500
|
+
*/
|
|
501
|
+
declare function neqHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, value: FragmentValueNullable<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
502
|
+
/**
|
|
503
|
+
* Generates an inequality condition (`!= value`) from a field name.
|
|
504
|
+
* Automatically converts `null`/`undefined` to `IS NOT NULL`.
|
|
505
|
+
*
|
|
506
|
+
* @param fieldName - The entity field name to compare
|
|
507
|
+
* @param value - The value to compare against
|
|
508
|
+
*/
|
|
343
509
|
declare function neqHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, value: TFields[N]): SQLFragment<TFields>;
|
|
344
|
-
|
|
510
|
+
/**
|
|
511
|
+
* Generates a greater-than condition (`> value`) from a fragment.
|
|
512
|
+
*
|
|
513
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to compare
|
|
514
|
+
* @param value - The value to compare against
|
|
515
|
+
*/
|
|
516
|
+
declare function gtHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, value: FragmentValue<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
517
|
+
/**
|
|
518
|
+
* Generates a greater-than condition (`> value`) from a field name.
|
|
519
|
+
*
|
|
520
|
+
* @param fieldName - The entity field name to compare
|
|
521
|
+
* @param value - The value to compare against
|
|
522
|
+
*/
|
|
345
523
|
declare function gtHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, value: TFields[N]): SQLFragment<TFields>;
|
|
346
|
-
|
|
524
|
+
/**
|
|
525
|
+
* Generates a greater-than-or-equal-to condition (`>= value`) from a fragment.
|
|
526
|
+
*
|
|
527
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to compare
|
|
528
|
+
* @param value - The value to compare against
|
|
529
|
+
*/
|
|
530
|
+
declare function gteHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, value: FragmentValue<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
531
|
+
/**
|
|
532
|
+
* Generates a greater-than-or-equal-to condition (`>= value`) from a field name.
|
|
533
|
+
*
|
|
534
|
+
* @param fieldName - The entity field name to compare
|
|
535
|
+
* @param value - The value to compare against
|
|
536
|
+
*/
|
|
347
537
|
declare function gteHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, value: TFields[N]): SQLFragment<TFields>;
|
|
348
|
-
|
|
538
|
+
/**
|
|
539
|
+
* Generates a less-than condition (`< value`) from a fragment.
|
|
540
|
+
*
|
|
541
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to compare
|
|
542
|
+
* @param value - The value to compare against
|
|
543
|
+
*/
|
|
544
|
+
declare function ltHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, value: FragmentValue<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
545
|
+
/**
|
|
546
|
+
* Generates a less-than condition (`< value`) from a field name.
|
|
547
|
+
*
|
|
548
|
+
* @param fieldName - The entity field name to compare
|
|
549
|
+
* @param value - The value to compare against
|
|
550
|
+
*/
|
|
349
551
|
declare function ltHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, value: TFields[N]): SQLFragment<TFields>;
|
|
350
|
-
|
|
552
|
+
/**
|
|
553
|
+
* Generates a less-than-or-equal-to condition (`<= value`) from a fragment.
|
|
554
|
+
*
|
|
555
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to compare
|
|
556
|
+
* @param value - The value to compare against
|
|
557
|
+
*/
|
|
558
|
+
declare function lteHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, value: FragmentValue<TFragment>): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
559
|
+
/**
|
|
560
|
+
* Generates a less-than-or-equal-to condition (`<= value`) from a field name.
|
|
561
|
+
*
|
|
562
|
+
* @param fieldName - The entity field name to compare
|
|
563
|
+
* @param value - The value to compare against
|
|
564
|
+
*/
|
|
351
565
|
declare function lteHelper<TFields extends Record<string, any>, N extends PickSupportedSQLValueKeys<TFields>>(fieldName: N, value: TFields[N]): SQLFragment<TFields>;
|
|
352
|
-
|
|
566
|
+
/**
|
|
567
|
+
* Generates a JSON contains condition (`@>`) from a fragment.
|
|
568
|
+
* Tests whether the JSON value contains the given value.
|
|
569
|
+
*
|
|
570
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
571
|
+
* @param value - The JSON value to check containment of
|
|
572
|
+
*/
|
|
573
|
+
declare function jsonContainsHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, value: JsonSerializable): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
574
|
+
/**
|
|
575
|
+
* Generates a JSON contains condition (`@>`) from a field name.
|
|
576
|
+
* Tests whether the JSON value contains the given value.
|
|
577
|
+
*
|
|
578
|
+
* @param fieldName - The entity field name to check
|
|
579
|
+
* @param value - The JSON value to check containment of
|
|
580
|
+
*/
|
|
353
581
|
declare function jsonContainsHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N, value: JsonSerializable): SQLFragment<TFields>;
|
|
354
|
-
|
|
582
|
+
/**
|
|
583
|
+
* Generates a JSON contained-by condition (`<@`) from a fragment.
|
|
584
|
+
* Tests whether the JSON value is contained by the given value.
|
|
585
|
+
*
|
|
586
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to check
|
|
587
|
+
* @param value - The JSON value to check containment against
|
|
588
|
+
*/
|
|
589
|
+
declare function jsonContainedByHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, value: JsonSerializable): SQLFragment<ExtractFragmentFields<TFragment>>;
|
|
590
|
+
/**
|
|
591
|
+
* Generates a JSON contained-by condition (`<@`) from a field name.
|
|
592
|
+
* Tests whether the JSON value is contained by the given value.
|
|
593
|
+
*
|
|
594
|
+
* @param fieldName - The entity field name to check
|
|
595
|
+
* @param value - The JSON value to check containment against
|
|
596
|
+
*/
|
|
355
597
|
declare function jsonContainedByHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N, value: JsonSerializable): SQLFragment<TFields>;
|
|
356
|
-
|
|
598
|
+
/**
|
|
599
|
+
* JSON path extraction (`->`) from a fragment. Returns JSON.
|
|
600
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
601
|
+
*
|
|
602
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to extract from
|
|
603
|
+
* @param path - The JSON key to extract
|
|
604
|
+
*/
|
|
605
|
+
declare function jsonPathHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, path: string): SQLChainableFragment<ExtractFragmentFields<TFragment>, SupportedSQLValue>;
|
|
606
|
+
/**
|
|
607
|
+
* JSON path extraction (`->`) from a field name. Returns JSON.
|
|
608
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
609
|
+
*
|
|
610
|
+
* @param fieldName - The entity field name to extract from
|
|
611
|
+
* @param path - The JSON key to extract
|
|
612
|
+
*/
|
|
357
613
|
declare function jsonPathHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N, path: string): SQLChainableFragment<TFields, SupportedSQLValue>;
|
|
358
|
-
|
|
614
|
+
/**
|
|
615
|
+
* JSON path text extraction (`->>`) from a fragment. Returns text.
|
|
616
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
617
|
+
*
|
|
618
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to extract from
|
|
619
|
+
* @param path - The JSON key to extract as text
|
|
620
|
+
*/
|
|
621
|
+
declare function jsonPathTextHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, path: string): SQLChainableFragment<ExtractFragmentFields<TFragment>, SupportedSQLValue>;
|
|
622
|
+
/**
|
|
623
|
+
* JSON path text extraction (`->>`) from a field name. Returns text.
|
|
624
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
625
|
+
*
|
|
626
|
+
* @param fieldName - The entity field name to extract from
|
|
627
|
+
* @param path - The JSON key to extract as text
|
|
628
|
+
*/
|
|
359
629
|
declare function jsonPathTextHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N, path: string): SQLChainableFragment<TFields, SupportedSQLValue>;
|
|
360
|
-
|
|
630
|
+
/**
|
|
631
|
+
* JSON deep path extraction (`#>`) from a fragment. Returns JSON at the specified key path.
|
|
632
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
633
|
+
*
|
|
634
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to extract from
|
|
635
|
+
* @param path - Array of keys forming the path (e.g., ['user', 'address', 'city'])
|
|
636
|
+
*/
|
|
637
|
+
declare function jsonDeepPathHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, path: readonly string[]): SQLChainableFragment<ExtractFragmentFields<TFragment>, SupportedSQLValue>;
|
|
638
|
+
/**
|
|
639
|
+
* JSON deep path extraction (`#>`) from a field name. Returns JSON at the specified key path.
|
|
640
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
641
|
+
*
|
|
642
|
+
* @param fieldName - The entity field name to extract from
|
|
643
|
+
* @param path - Array of keys forming the path (e.g., ['user', 'address', 'city'])
|
|
644
|
+
*/
|
|
361
645
|
declare function jsonDeepPathHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N, path: readonly string[]): SQLChainableFragment<TFields, SupportedSQLValue>;
|
|
362
|
-
|
|
646
|
+
/**
|
|
647
|
+
* JSON deep path text extraction (`#>>`) from a fragment. Returns text at the specified key path.
|
|
648
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
649
|
+
*
|
|
650
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to extract from
|
|
651
|
+
* @param path - Array of keys forming the path (e.g., ['user', 'address', 'city'])
|
|
652
|
+
*/
|
|
653
|
+
declare function jsonDeepPathTextHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, path: readonly string[]): SQLChainableFragment<ExtractFragmentFields<TFragment>, SupportedSQLValue>;
|
|
654
|
+
/**
|
|
655
|
+
* JSON deep path text extraction (`#>>`) from a field name. Returns text at the specified key path.
|
|
656
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
657
|
+
*
|
|
658
|
+
* @param fieldName - The entity field name to extract from
|
|
659
|
+
* @param path - Array of keys forming the path (e.g., ['user', 'address', 'city'])
|
|
660
|
+
*/
|
|
363
661
|
declare function jsonDeepPathTextHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N, path: readonly string[]): SQLChainableFragment<TFields, SupportedSQLValue>;
|
|
364
|
-
|
|
662
|
+
/**
|
|
663
|
+
* SQL type cast (`::type`) from a fragment.
|
|
664
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
665
|
+
*
|
|
666
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to cast
|
|
667
|
+
* @param typeName - The PostgreSQL type name (e.g., 'int', 'text', 'timestamptz')
|
|
668
|
+
*/
|
|
669
|
+
declare function castHelper<TFragment extends SQLFragment<any>>(fragment: TFragment, typeName: PostgresCastType): SQLChainableFragment<ExtractFragmentFields<TFragment>, SupportedSQLValue>;
|
|
670
|
+
/**
|
|
671
|
+
* SQL type cast (`::type`) from a field name.
|
|
672
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
673
|
+
*
|
|
674
|
+
* @param fieldName - The entity field name to cast
|
|
675
|
+
* @param typeName - The PostgreSQL type name (e.g., 'int', 'text', 'timestamptz')
|
|
676
|
+
*/
|
|
365
677
|
declare function castHelper<TFields extends Record<string, any>, N extends keyof TFields>(fieldName: N, typeName: PostgresCastType): SQLChainableFragment<TFields, SupportedSQLValue>;
|
|
366
|
-
|
|
678
|
+
/**
|
|
679
|
+
* Wraps a fragment in `LOWER()` to convert to lowercase.
|
|
680
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
681
|
+
*
|
|
682
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to convert
|
|
683
|
+
*/
|
|
684
|
+
declare function lowerHelper<TFragment extends SQLFragment<any>>(fragment: TFragment): SQLChainableFragment<ExtractFragmentFields<TFragment>, SupportedSQLValue>;
|
|
685
|
+
/**
|
|
686
|
+
* Wraps a field in `LOWER()` to convert to lowercase.
|
|
687
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
688
|
+
*
|
|
689
|
+
* @param fieldName - The entity field name to convert
|
|
690
|
+
*/
|
|
367
691
|
declare function lowerHelper<TFields extends Record<string, any>, N extends PickStringValueKeys<TFields>>(fieldName: N): SQLChainableFragment<TFields, TFields[N]>;
|
|
368
|
-
|
|
692
|
+
/**
|
|
693
|
+
* Wraps a fragment in `UPPER()` to convert to uppercase.
|
|
694
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
695
|
+
*
|
|
696
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to convert
|
|
697
|
+
*/
|
|
698
|
+
declare function upperHelper<TFragment extends SQLFragment<any>>(fragment: TFragment): SQLChainableFragment<ExtractFragmentFields<TFragment>, SupportedSQLValue>;
|
|
699
|
+
/**
|
|
700
|
+
* Wraps a field in `UPPER()` to convert to uppercase.
|
|
701
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
702
|
+
*
|
|
703
|
+
* @param fieldName - The entity field name to convert
|
|
704
|
+
*/
|
|
369
705
|
declare function upperHelper<TFields extends Record<string, any>, N extends PickStringValueKeys<TFields>>(fieldName: N): SQLChainableFragment<TFields, TFields[N]>;
|
|
370
|
-
|
|
706
|
+
/**
|
|
707
|
+
* Wraps a fragment in `TRIM()` to remove leading and trailing whitespace.
|
|
708
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
709
|
+
*
|
|
710
|
+
* @param fragment - A SQLFragment or SQLChainableFragment to trim
|
|
711
|
+
*/
|
|
712
|
+
declare function trimHelper<TFragment extends SQLFragment<any>>(fragment: TFragment): SQLChainableFragment<ExtractFragmentFields<TFragment>, SupportedSQLValue>;
|
|
713
|
+
/**
|
|
714
|
+
* Wraps a field in `TRIM()` to remove leading and trailing whitespace.
|
|
715
|
+
* Returns an SQLChainableFragment for fluent chaining.
|
|
716
|
+
*
|
|
717
|
+
* @param fieldName - The entity field name to trim
|
|
718
|
+
*/
|
|
371
719
|
declare function trimHelper<TFields extends Record<string, any>, N extends PickStringValueKeys<TFields>>(fieldName: N): SQLChainableFragment<TFields, TFields[N]>;
|
|
372
720
|
/**
|
|
373
721
|
* Common SQL helper functions for building queries.
|