import { MySqlDialect } from "../dialect.cjs";
import { AnyMySqlMapper, MySqlBasePreparedQuery, MySqlPreparedQueryConfig, MySqlQueryResultHKT, MySqlSession, MySqlTransactionConfig } from "../session.cjs";
import { MySqlAsyncDatabase } from "./db.cjs";
import { entityKind } from "../../entity.cjs";
import { Query, SQL } from "../../sql/sql.cjs";
import { Logger } from "../../logger.cjs";
import { MigrationConfig, MigrationMeta, MigratorInitFailResponse } from "../../migrator.cjs";
import { AnyRelations, EmptyRelations } from "../../relations.cjs";
import { WithCacheConfig } from "../../cache/core/types.cjs";
import { Cache } from "../../cache/core/cache.cjs";

//#region src/mysql-core/async/session.d.ts
declare class MySqlAsyncPreparedQuery<T extends MySqlPreparedQueryConfig> extends MySqlBasePreparedQuery {
  protected executor: (params?: unknown[]) => Promise<any>;
  protected _iterator: ((params?: unknown[]) => AsyncGenerator<any[]>) | undefined;
  readonly mode: 'arrays' | 'objects' | 'raw';
  protected logger: Logger;
  private cache;
  private queryMetadata;
  private cacheConfig?;
  static readonly [entityKind]: string;
  private fastPath;
  constructor(executor: (params?: unknown[]) => Promise<any>, _iterator: ((params?: unknown[]) => AsyncGenerator<any[]>) | undefined, query: Query, mapper: AnyMySqlMapper | undefined, mode: 'arrays' | 'objects' | 'raw', logger: Logger, cache: Cache | undefined, queryMetadata: {
    type: 'select' | 'update' | 'delete' | 'insert';
    tables: string[];
  } | undefined, cacheConfig?: WithCacheConfig | undefined);
  execute(placeholderValues?: Record<string, unknown>): Promise<T['execute']>;
  iterator(placeholderValues?: Record<string, unknown>): AsyncGenerator<T['iterator']>;
}
declare abstract class MySqlAsyncSession<TQueryResult extends MySqlQueryResultHKT = MySqlQueryResultHKT, TRelations extends AnyRelations = EmptyRelations> extends MySqlSession {
  static readonly [entityKind]: string;
  abstract prepareQuery<T extends MySqlPreparedQueryConfig>(query: Query, mode: 'arrays' | 'objects' | 'raw', mapper?: (rows: any) => any, queryMetadata?: {
    type: 'select' | 'update' | 'delete' | 'insert';
    tables: string[];
  }, cacheConfig?: WithCacheConfig): MySqlAsyncPreparedQuery<T>;
  execute<T>(query: SQL): Promise<T>;
  arrays<T>(query: SQL): Promise<T[]>;
  objects<T>(query: SQL): Promise<T[]>;
  abstract transaction<T>(transaction: (tx: MySqlAsyncTransaction<TQueryResult, TRelations>) => Promise<T>, config?: MySqlTransactionConfig): Promise<T>;
}
declare abstract class MySqlAsyncTransaction<TQueryResult extends MySqlQueryResultHKT, TRelations extends AnyRelations = EmptyRelations> extends MySqlAsyncDatabase<TQueryResult, TRelations> {
  protected relations: TRelations;
  protected readonly nestedIndex: number;
  static readonly [entityKind]: string;
  constructor(dialect: MySqlDialect, session: MySqlAsyncSession, relations: TRelations, nestedIndex: number);
  rollback(): never;
  /** Nested transactions (aka savepoints) only work with InnoDB engine. */
  abstract transaction<T>(transaction: (tx: MySqlAsyncTransaction<TQueryResult, TRelations>) => Promise<T>): Promise<T>;
}
declare function migrate(migrations: MigrationMeta[], db: MySqlAsyncDatabase<MySqlQueryResultHKT, any>, config: Omit<MigrationConfig, 'migrationsSchema'>): Promise<void | MigratorInitFailResponse>;
//#endregion
export { MySqlAsyncPreparedQuery, MySqlAsyncSession, MySqlAsyncTransaction, migrate };
//# sourceMappingURL=session.d.cts.map