Skip to main content

Function: withDatabaseOperation()

function withDatabaseOperation<T>(
operation: OperationalHookOperation<T>,
operationName: string,
eventEmitter?: TypedEventBus<UptimeEvents>,
context?: OperationalHookContextInput
): Promise<T>;

Defined in: electron/utils/operationalHooks.ts:811

Specialized wrapper for database operations with database-specific defaults.

Type Parameters​

T​

T

The return type of the database operation

Parameters​

operation​

OperationalHookOperation<T>

Database operation to execute with retry logic

operationName​

string

Name of the database operation (will be prefixed with "database:")

eventEmitter?​

TypedEventBus<UptimeEvents>

Optional event emitter for operation lifecycle events

context?​

OperationalHookContextInput

Optional context data to include in events

Returns​

Promise<T>

Promise resolving to the operation result

Remarks​

This function is a convenience wrapper around withOperationalHooks that applies database-optimized settings and adds a "database:" prefix to operation names for consistent event naming. While the underlying implementation is generic, this wrapper should only be used for actual database operations to maintain clear semantic boundaries and event categorization.