import { entityKind } from "../entity.cjs";
import { Query } from "../sql/sql.cjs";
import { Simplify } from "../utils.cjs";
import { Logger } from "../logger.cjs";
import { AnyRelations } from "../relations.cjs";
import { WithCacheConfig } from "../cache/core/types.cjs";
import { Cache } from "../cache/core/cache.cjs";
import { PgDialect } from "../pg-core/dialect.cjs";
import { PgQueryResultHKT, PgTransactionConfig, PreparedQueryConfig } from "../pg-core/session.cjs";
import { PgAsyncPreparedQuery, PgAsyncSession, PgAsyncTransaction } from "../pg-core/async/session.cjs";
import { Connection, Pool, QueryResult, ShapeSpec } from "@drizzle-team/minipg";
import { BatchItem } from "../batch";

//#region src/postgres/session.d.ts
type PostgresClient = Pool | Connection;
interface PostgresSessionOptions {
  logger?: Logger;
  cache?: Cache;
}
declare class PostgresSession<TRelations extends AnyRelations> extends PgAsyncSession<PostgresQueryResultHKT, TRelations> {
  private client;
  private relations;
  private options;
  static readonly [entityKind]: string;
  private logger;
  private cache;
  constructor(client: PostgresClient, dialect: PgDialect, relations: TRelations, options?: PostgresSessionOptions);
  prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, mode: 'arrays' | 'objects' | 'raw', name: string | boolean, mapper: ((rows: any[]) => any) | undefined, queryMetadata?: {
    type: 'select' | 'update' | 'delete' | 'insert';
    tables: string[];
  }, cacheConfig?: WithCacheConfig, shape?: ShapeSpec): PostgresPreparedQuery<T>;
  batch<U extends BatchItem<'pg'>, T extends Readonly<[U, ...U[]]>>(queries: T): Promise<any[]>;
  transaction<T>(transaction: (tx: PostgresTransaction<TRelations>) => Promise<T>, config?: PgTransactionConfig | undefined): Promise<T>;
}
declare class PostgresTransaction<TRelations extends AnyRelations> extends PgAsyncTransaction<PostgresQueryResultHKT, TRelations> {
  static readonly [entityKind]: string;
  transaction<T>(transaction: (tx: PostgresTransaction<TRelations>) => Promise<T>): Promise<T>;
}
type PostgresQueryResult<T> = Omit<QueryResult<T>, 'metrics' | 'debug'>;
interface PostgresQueryResultHKT extends PgQueryResultHKT {
  type: Simplify<Omit<QueryResult<this['row']>, 'metrics' | 'debug'>>;
}
declare class PostgresPreparedQuery<T extends PreparedQueryConfig> extends PgAsyncPreparedQuery<T> {
  readonly shape?: ShapeSpec | undefined;
  static readonly [entityKind]: string;
  constructor(executor: (params?: unknown[]) => Promise<any>, query: Query, mapper: ((rows: any[]) => any) | undefined, mode: 'arrays' | 'objects' | 'raw', logger: Logger, cache: Cache | undefined, queryMetadata: {
    type: 'select' | 'update' | 'delete' | 'insert';
    tables: string[];
  } | undefined, cacheConfig: WithCacheConfig | undefined, shape?: ShapeSpec | undefined);
}
//#endregion
export { PostgresClient, PostgresPreparedQuery, PostgresQueryResult, PostgresQueryResultHKT, PostgresSession, PostgresSessionOptions, PostgresTransaction };
//# sourceMappingURL=session.d.cts.map