MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / lockPessimistic

Function lockPessimistic

packages/sql/src/AbstractSqlDriver.ts:3082–3093  ·  view source on GitHub ↗
(entity: T, options: LockOptions)

Source from the content-addressed store, hash-verified

3080 }
3081
3082 override async lockPessimistic<T extends object>(entity: T, options: LockOptions): Promise<void> {
3083 const meta = helper(entity).__meta;
3084 const qb = this.createQueryBuilder(meta.class, options.ctx, undefined, undefined, options.logging).withSchema(
3085 options.schema ?? meta.schema,
3086 );
3087 qb.setAbortOptions(pickAbortOptions(options));
3088 const cond = Utils.getPrimaryKeyCond(entity, meta.primaryKeys);
3089 qb.select(raw('1'))
3090 .where(cond as any)
3091 .setLockMode(options.lockMode, options.lockTableAliases);
3092 await this.rethrow(qb.execute());
3093 }
3094
3095 protected buildPopulateWhere<T extends object>(
3096 meta: EntityMetadata<T>,

Callers

nothing calls this directly

Calls 12

helperFunction · 0.90
rawFunction · 0.90
pickAbortOptionsFunction · 0.85
setAbortOptionsMethod · 0.80
getPrimaryKeyCondMethod · 0.80
rethrowMethod · 0.80
withSchemaMethod · 0.65
whereMethod · 0.65
selectMethod · 0.65
executeMethod · 0.65
createQueryBuilderMethod · 0.45
setLockModeMethod · 0.45

Tested by

no test coverage detected