import type { SchemaValue, ValueType } from '../../../zero-schema/src/table-schema.ts';
import type { LiteTableSpec } from '../db/specs.ts';
import { type PostgresValueType } from './pg.ts';
import type { RowValue } from './row-key.ts';
/** Javascript value types supported by better-sqlite3. */
export type LiteValueType = number | bigint | string | null | Uint8Array;
export type LiteRow = Readonly<Record<string, LiteValueType>>;
export type LiteRowKey = LiteRow;
export declare const JSON_STRINGIFIED = "s";
export declare const JSON_PARSED = "p";
export type JSONFormat = typeof JSON_STRINGIFIED | typeof JSON_PARSED;
/**
 * Creates a LiteRow from the supplied RowValue. A copy of the `row`
 * is made only if a value conversion is performed.
 */
export declare function liteRow(row: RowValue, table: LiteTableSpec, jsonFormat: JSONFormat): {
    row: LiteRow;
    numCols: number;
};
/**
 * Postgres values types that are supported by SQLite are stored as-is.
 * This includes Uint8Arrays for the `bytea` / `BLOB` type.
 * * `boolean` values are converted to `0` or `1` integers.
 * * `PreciseDate` values are converted to epoch microseconds.
 * * JSON and Array values are stored as `JSON.stringify()` strings.
 *
 * Note that this currently does not handle the `bytea[]` type, but that's
 * already a pretty questionable type.
 */
export declare function liteValue(val: PostgresValueType, pgType: string, jsonFormat: JSONFormat): LiteValueType;
export declare function mapLiteDataTypeToZqlSchemaValue(liteDataType: LiteTypeString): SchemaValue;
export declare const TEXT_ARRAY_ATTRIBUTE = "|TEXT_ARRAY";
/**
 * The `LiteTypeString` utilizes SQLite's loose type system to encode
 * auxiliary information about the upstream column (e.g. type and
 * constraints) that does not necessarily affect how SQLite handles the data,
 * but nonetheless determines how higher level logic handles the data.
 *
 * The format of the type string is the original upstream type, followed
 * by any number of attributes, each of which begins with the `|` character,
 * and optionally ending with `[]` to indicate an array type.
 * The current list of attributes are:
 * * `|NOT_NULL` to indicate that the upstream column does not allow nulls
 * * `|TEXT_ENUM` to indicate an enum that should be treated as a string
 * * `[]` suffix to indicate an array type
 *
 * Note: The legacy `|TEXT_ARRAY` attribute is still supported for backwards
 * compatibility but new data uses the `[]` suffix instead.
 *
 * Examples:
 * * `int8`
 * * `int8|NOT_NULL`
 * * `timestamp with time zone`
 * * `timestamp with time zone|NOT_NULL`
 * * `nomz|TEXT_ENUM`
 * * `nomz|NOT_NULL|TEXT_ENUM`
 * * `int8[]`
 * * `int8|NOT_NULL[]`
 * * `nomz|TEXT_ENUM[]`
 */
export type LiteTypeString = string;
/**
 * Formats a {@link LiteTypeString}.
 */
export declare function liteTypeString(upstreamDataType: string, notNull: boolean | null | undefined, textEnum: boolean): LiteTypeString;
export declare function upstreamDataType(liteTypeString: LiteTypeString): string;
export declare function nullableUpstream(liteTypeString: LiteTypeString): boolean;
/**
 * Returns the value type for the `pgDataType` if it is supported by ZQL.
 * (Note that `pgDataType` values are stored as-is in the SQLite column defs).
 *
 * For types not supported by ZQL, returns `undefined`.
 */
export declare function dataTypeToZqlValueType(liteTypeString: LiteTypeString): ValueType | undefined;
export declare function isEnum(liteTypeString: LiteTypeString): boolean;
export declare function isArray(liteTypeString: LiteTypeString): boolean;
//# sourceMappingURL=lite.d.ts.map