@mwcp/kmore
Version:
midway component for knex, supports declarative transaction and OpenTelemetry
25 lines • 1.54 kB
TypeScript
import { IMidwayContainer } from '@midwayjs/core';
import { TraceScopeType, TraceService } from '@mwcp/otel';
import { Application, Context } from '@mwcp/share';
import { type HookReturn, type KmoreTransaction, type TransactionHookOptions, type TransactionPreHookOptions } from 'kmore';
import { TrxStatusService } from '../trx-status.service.js';
import { DbConfig } from '../types.js';
export declare class DbHookTrx<SourceName extends string = string> {
private readonly sourceConfig;
readonly app: Application;
readonly applicationContext: IMidwayContainer;
readonly appDir: string;
readonly baseDir: string;
readonly trxStatusSvc: TrxStatusService;
readonly traceService: TraceService;
getDbConfigByDbId(dbId: SourceName): DbConfig | undefined;
getWebContext(): Context | undefined;
getTraceScopeByTrx(transaction: KmoreTransaction): TraceScopeType;
transactionPreHook(this: DbHookTrx, options: TransactionPreHookOptions): Promise<HookReturn | undefined>;
transactionPostHook(this: DbHookTrx, options: TransactionHookOptions): Promise<void>;
beforeCommitHook(this: DbHookTrx<SourceName>, options: TransactionHookOptions): Promise<void>;
afterCommitHook(this: DbHookTrx<SourceName>, options: TransactionHookOptions): Promise<void>;
beforeRollbackHook(this: DbHookTrx<SourceName>, options: TransactionHookOptions): Promise<void>;
afterRollbackHook(this: DbHookTrx<SourceName>, options: TransactionHookOptions): Promise<void>;
}
//# sourceMappingURL=db-hook.trx.d.ts.map