Skip to content
# Class: SqlParamInjector

Defined in: packages/core/src/transformers/SqlParamInjector.ts:32

SqlParamInjector injects state parameters into a SelectQuery model, creating WHERE conditions and setting parameter values.

Constructors ​

Constructor ​

new SqlParamInjector(optionsOrResolver?, options?): SqlParamInjector

Defined in: packages/core/src/transformers/SqlParamInjector.ts:36

Parameters ​

optionsOrResolver? ​

SqlParamInjectorOptions | (tableName) => string[]

options? ​

SqlParamInjectorOptions

Returns ​

SqlParamInjector

Methods ​

inject() ​

inject(query, state): SelectQuery

Defined in: packages/core/src/transformers/SqlParamInjector.ts:54

Injects parameters as WHERE conditions into the given query model.

Parameters ​

query ​

The SelectQuery to modify

string | SimpleSelectQuery

state ​

Record<string, StateParameterValue | null | undefined&gt;

A record of parameter names and values

Returns ​

SelectQuery

The modified SelectQuery

Throws ​

Error when all parameters are undefined and allowAllUndefined is not set to true

Released under the MIT License.