Skip to main content

Function: buildMonitorParameters()

buildMonitorParameters(siteIdentifier: string, monitor: Monitor): DbValue[]

Defined in: electron/services/database/utils/monitorMapper.ts:182

Builds a parameter array for inserting or updating a monitor in the database.

Parameters

siteIdentifier

string

The unique identifier of the site this monitor belongs to.

monitor

Monitor

The monitor object to convert.

Returns

DbValue[]

An array of values for SQL parameterized queries.

Remarks

Converts a monitor object to a row format using the dynamic schema system, then returns an array of values in the order expected by the SQL statement. All values are type-safe and nulls are used for missing/undefined fields.

Example

const params = buildMonitorParameters("site-123", monitorObj);
db.run("INSERT INTO monitors (...) VALUES (?, ?, ...)", params);

Throws

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Error if mapping or parameter generation fails.

See