@eggjs/dal-runtime
Version:
tegg dal decorator
29 lines (28 loc) • 974 B
TypeScript
import type { QueryOptions, RDSClientOptions } from '@eggjs/rds';
import Base from 'sdk-base';
import { Logger } from '@eggjs/tegg-types';
export interface DataSourceOptions extends RDSClientOptions {
name: string;
initSql?: string;
forkDb?: boolean;
initRetryTimes?: number;
logger?: Logger;
executeType?: 'execute' | 'query';
}
export interface EggQueryOptions extends QueryOptions {
executeType?: 'execute' | 'query';
}
export declare class MysqlDataSource extends Base {
#private;
private client;
private readonly initSql;
readonly name: string;
readonly timezone?: string;
readonly rdsOptions: RDSClientOptions;
readonly forkDb?: boolean;
private readonly executeType;
constructor(options: DataSourceOptions);
protected _init(): Promise<void>;
query<T = any>(sql: string, params?: any[], options?: EggQueryOptions): Promise<T>;
beginTransactionScope<T>(scope: () => Promise<T>): Promise<T>;
}