withLockedDb Method

Perform an operation on this database with the lock held and the database opened for write

withLockedDb<T>(args: { openMode?: OpenMode, operationName: string, user?: string }, operation: () => Promise<T>): Promise<T>

@returns A promise that resolves to the the return value of operation.

@see SQLiteDb.withLockedContainer

@note Most uses of CloudSqliteDbAccess require that the lock not be held by any operation for long. Make sure you don't do any avoidable or time consuming work in your operation function.

Parameter Type Description
args { openMode?: OpenMode, operationName: string, user?: string }  
operation () => Promise<T> a function called with the lock held and the database open for write.

Returns - Promise<T>

A promise that resolves to the the return value of operation.

Defined in

Last Updated: 17 December, 2024