Function
| Static Public Summary | ||
| public |
format(arr: unknown[], dialect: AbstractDialect): * this function was deprecated. use {@link injectReplacements} instead. This method has been removed in v7.
|
|
| public |
formatNamedParameters(sql: string, parameters: object, dialect: AbstractDialect): * this function was deprecated. use {@link injectReplacements} instead. This method has been removed in v7.
|
|
| public |
injectReplacements(sqlString: *, dialect: *, replacements: *): * Inlines replacements in places where they would be valid SQL values. |
|
| public |
safeStringifyJson(value: any): string Stringify a value as JSON with some differences:
|
|
Static Public
public format(arr: unknown[], dialect: AbstractDialect): * source
Params:
| Name | Type | Attribute | Description |
| arr | unknown[] | first item is the SQL, following items are the positional replacements. |
|
| dialect | AbstractDialect |
Return:
| * |
public formatNamedParameters(sql: string, parameters: object, dialect: AbstractDialect): * source
Return:
| * |
public injectReplacements(sqlString: *, dialect: *, replacements: *): * source
Inlines replacements in places where they would be valid SQL values.
Params:
| Name | Type | Attribute | Description |
| sqlString | * | The SQL that contains the replacements |
|
| dialect | * | The dialect of the SQL |
|
| replacements | * | if provided, this method will replace ':named' replacements & positional replacements (?) |
Return:
| * | The SQL with replacements rewritten in their dialect-specific syntax. |
public safeStringifyJson(value: any): string source
Stringify a value as JSON with some differences:
- bigints are stringified as a json string. (
safeStringifyJson({ val: 1n })outputs'{ "val": "1" }'). This is because of a decision by TC39 to not support bigint in JSON.stringify https://github.com/tc39/proposal-bigint/issues/24
Params:
| Name | Type | Attribute | Description |
| value | any | the value to stringify. |
Guides
Reference
Source
