import { MySqlCodecs, MySqlType } from "./codecs.cjs";
import { MySqlTable } from "./table.cjs";
import { MySqlView } from "./view.cjs";
import { MySqlSelectConfig, SelectedFieldsOrdered } from "./query-builders/select.types.cjs";
import { MySqlDeleteConfig } from "./query-builders/delete.cjs";
import { MySqlUpdateConfig } from "./query-builders/update.cjs";
import { MySqlInsertConfig } from "./query-builders/insert.cjs";
import { entityKind } from "../entity.cjs";
import { DriverValueEncoder, Query, SQL } from "../sql/sql.cjs";
import { RowsMapperGenerator, UpdateSet, make$ReturningResponseMapper } from "../utils.cjs";
import { BuildRelationalQueryResult, DBQueryConfigWithComment, RelationalRowsMapperGenerator, TableRelationalConfig, TablesRelationalConfig } from "../relations.cjs";
import { CodecsCollection } from "../codecs.cjs";

//#region src/mysql-core/dialect.d.ts
interface MySqlDialectConfig {
  escapeParam?: (num: number) => string;
  codecs?: MySqlCodecs;
  useJitMappers?: boolean;
  /** Resolves mysql binary protocol bug that rejects numbers in pagination */
  paginationToBigint?: boolean;
}
declare class MySqlDialect {
  static readonly [entityKind]: string;
  readonly codecs: CodecsCollection<MySqlType>;
  readonly mapperGenerators: {
    rows: RowsMapperGenerator;
    relationalRows: RelationalRowsMapperGenerator;
    $returning: typeof make$ReturningResponseMapper;
  };
  readonly paginationEncoder: DriverValueEncoder<any, any>;
  constructor(config?: MySqlDialectConfig);
  escapeName(name: string): string;
  escapeParam(_num: number): string;
  escapeString(str: string): string;
  private buildWithCTE;
  buildDeleteQuery({
    table,
    where,
    withList,
    limit,
    orderBy,
    comment
  }: MySqlDeleteConfig): SQL;
  buildUpdateSet(table: MySqlTable, set: UpdateSet): SQL;
  buildUpdateQuery({
    table,
    set,
    where,
    withList,
    limit,
    orderBy,
    comment
  }: MySqlUpdateConfig): SQL;
  /**
   * Builds selection SQL with provided fields/expressions
   *
   * Examples:
   *
   * `select <selection> from`
   *
   * If `isSingleTable` is true, then columns won't be prefixed with table name
   */
  private buildSelection;
  private buildLimit;
  private buildOrderBy;
  private buildIndex;
  buildSelectQuery({
    withList,
    fieldsFlat,
    where,
    having,
    table,
    joins,
    orderBy,
    groupBy,
    limit,
    offset,
    lockingClause,
    distinct,
    setOperators,
    useIndex,
    forceIndex,
    ignoreIndex,
    comment,
    ignoreSelectionCastCodecs
  }: MySqlSelectConfig): SQL;
  buildSetOperations(leftSelect: SQL, leftSelection: SelectedFieldsOrdered, ignoreSelectionCastCodecs: boolean | undefined, setOperators: MySqlSelectConfig['setOperators']): SQL;
  buildSetOperationQuery({
    leftSelect,
    setOperator: {
      type,
      isAll,
      rightSelect,
      limit,
      orderBy,
      offset
    }
  }: {
    leftSelect: SQL;
    setOperator: MySqlSelectConfig['setOperators'][number];
  }): SQL;
  buildInsertQuery({
    table,
    values: valuesOrSelect,
    ignore,
    onConflict,
    select,
    columnList,
    comment
  }: MySqlInsertConfig): {
    sql: SQL;
    generatedIds: Record<string, unknown>[];
  };
  sqlToQuery(sql: SQL, invokeSource?: 'indexes' | undefined): Query;
  private buildRqbColumn;
  private buildColumns;
  buildRelationalQuery({
    schema,
    table,
    tableConfig,
    queryConfig: config,
    relationWhere,
    mode,
    errorPath,
    depth,
    isNestedMany,
    throughJoin,
    nested
  }: {
    schema: TablesRelationalConfig;
    table: MySqlTable | MySqlView;
    tableConfig: TableRelationalConfig;
    queryConfig?: DBQueryConfigWithComment<'many'> | true;
    relationWhere?: SQL;
    mode: 'first' | 'many';
    errorPath?: string;
    depth?: number;
    isNestedMany?: boolean;
    throughJoin?: SQL;
    nested?: boolean;
  }): BuildRelationalQueryResult;
}
//#endregion
export { MySqlDialect, MySqlDialectConfig };
//# sourceMappingURL=dialect.d.cts.map