export declare const bindAdapter: (adapter: DriverAdapter) => ErrorCapturingDriverAdapter;

export declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];

export declare const ColumnTypeEnum: {
    readonly Int32: 0;
    readonly Int64: 1;
    readonly Float: 2;
    readonly Double: 3;
    readonly Numeric: 4;
    readonly Boolean: 5;
    readonly Character: 6;
    readonly Text: 7;
    readonly Date: 8;
    readonly Time: 9;
    readonly DateTime: 10;
    readonly Json: 11;
    readonly Enum: 12;
    readonly Bytes: 13;
    readonly Set: 14;
    readonly Uuid: 15;
    readonly Int32Array: 64;
    readonly Int64Array: 65;
    readonly FloatArray: 66;
    readonly DoubleArray: 67;
    readonly NumericArray: 68;
    readonly BooleanArray: 69;
    readonly CharacterArray: 70;
    readonly TextArray: 71;
    readonly DateArray: 72;
    readonly TimeArray: 73;
    readonly DateTimeArray: 74;
    readonly JsonArray: 75;
    readonly EnumArray: 76;
    readonly BytesArray: 77;
    readonly UuidArray: 78;
    readonly UnknownNumber: 128;
};

export declare const Debug: debug.Debug;

export declare interface DriverAdapter extends Queryable {
    /**
     * Starts new transation.
     */
    startTransaction(): Promise<Result<Transaction>>;
}

export declare function err<T>(error: Error_2): Result<T>;

declare type Error_2 = {
    kind: 'GenericJs';
    id: number;
} | {
    kind: 'UnsupportedNativeDataType';
    type: string;
} | {
    kind: 'Postgres';
    code: string;
    severity: string;
    message: string;
    detail: string | undefined;
    column: string | undefined;
    hint: string | undefined;
} | {
    kind: 'Mysql';
    code: number;
    message: string;
    state: string;
} | {
    kind: 'Sqlite';
    /**
     * Sqlite extended error code: https://www.sqlite.org/rescode.html
     */
    extendedCode: number;
    message: string;
};
export { Error_2 as Error }

export declare interface ErrorCapturingDriverAdapter extends DriverAdapter {
    readonly errorRegistry: ErrorRegistry;
}

export declare type ErrorRecord = {
    error: unknown;
};

export declare interface ErrorRegistry {
    consumeError(id: number): ErrorRecord | undefined;
}

export declare function initialize(): void;

export declare const JsonNullMarker = "$__prisma_null";

export declare function ok<T>(value: T): Result<T>;

export declare type Query = {
    sql: string;
    args: Array<unknown>;
};

export declare interface Queryable {
    readonly provider: 'mysql' | 'postgres' | 'sqlite';
    /**
     * Execute a query given as SQL, interpolating the given parameters,
     * and returning the type-aware result set of the query.
     *
     * This is the preferred way of executing `SELECT` queries.
     */
    queryRaw(params: Query): Promise<Result<ResultSet>>;
    /**
     * Execute a query given as SQL, interpolating the given parameters,
     * and returning the number of affected rows.
     *
     * This is the preferred way of executing `INSERT`, `UPDATE`, `DELETE` queries,
     * as well as transactional queries.
     */
    executeRaw(params: Query): Promise<Result<number>>;
}

export declare type Result<T> = {
    map<U>(fn: (value: T) => U): Result<U>;
    flatMap<U>(fn: (value: T) => Result<U>): Result<U>;
} & ({
    readonly ok: true;
    readonly value: T;
} | {
    readonly ok: false;
    readonly error: Error_2;
});

export declare interface ResultSet {
    /**
     * List of column types appearing in a database query, in the same order as `columnNames`.
     * They are used within the Query Engine to convert values from JS to Quaint values.
     */
    columnTypes: Array<ColumnType>;
    /**
     * List of column names appearing in a database query, in the same order as `columnTypes`.
     */
    columnNames: Array<string>;
    /**
     * List of rows retrieved from a database query.
     * Each row is a list of values, whose length matches `columnNames` and `columnTypes`.
     */
    rows: Array<Array<unknown>>;
    /**
     * The last ID of an `INSERT` statement, if any.
     * This is required for `AUTO_INCREMENT` columns in MySQL and SQLite-flavoured databases.
     */
    lastInsertId?: string;
}

export declare interface Transaction extends Queryable {
    /**
     * Transaction options.
     */
    readonly options: TransactionOptions;
    /**
     * Commit the transaction.
     */
    commit(): Promise<Result<void>>;
    /**
     * Rolls back the transaction.
     */
    rollback(): Promise<Result<void>>;
}

export declare type TransactionOptions = {
    usePhantomQuery: boolean;
};

export { }
