import { Binary, Decimal, Time, Scalar, Uuid, List, Json, BaseScalar } from './scalar'; export declare type INT64 = { readonly type: 'INT64'; }; export declare type INT32 = { readonly type: 'INT32'; }; export declare type INT16 = { readonly type: 'INT16'; }; export declare type INT8 = { readonly type: 'INT8'; }; export declare type DECIMAL = { readonly type: 'DECIMAL'; readonly precision: number; readonly scale: number; }; export declare type FLOAT32 = { readonly type: 'FLOAT32'; }; export declare type FLOAT64 = { readonly type: 'FLOAT64'; }; export declare type STRING = { readonly type: 'STRING'; /** * 为0时表示无限大 */ readonly size: number; }; export declare type DATE = { readonly type: 'DATE'; }; export declare type DATETIME = { readonly type: 'DATETIME'; }; export declare type DATETIMEOFFSET = { readonly type: 'DATETIMEOFFSET'; }; export declare type TIME = { readonly type: 'TIME'; }; export declare type BINARY = { readonly type: 'BINARY'; readonly size: number; }; export declare type BOOLEAN = { readonly type: 'BOOLEAN'; }; export declare type UUID = { readonly type: 'UUID'; }; /** * 行标识列,如sqlserver的timestamp */ export declare type ROWFLAG = { readonly type: 'ROWFLAG'; }; /** * 对象类型,不使用JSON,是因为冲突 */ export declare type JSON = { readonly type: 'JSON'; }; /** * 列表类型,即数组,不使用ARRAY,亦是因为命名冲突 */ export declare type LIST = { readonly type: 'LIST'; /** * 元素类型 */ readonly innerType: DbType; }; export declare function isDbType(value: any): value is DbType; export declare type BaseDbType = INT8 | INT16 | INT32 | INT64 | DECIMAL | FLOAT32 | FLOAT64 | STRING | DATE | DATETIME | TIME | DATETIMEOFFSET | BINARY | BOOLEAN | UUID; export declare type DbType = BaseDbType | ROWFLAG | JSON | LIST; /** * 类型转换 */ export declare type ScalarFromDbType = T extends INT8 | INT16 | INT32 | FLOAT32 | FLOAT64 ? number : T extends DECIMAL ? Decimal : T extends INT64 ? bigint : T extends STRING ? string : T extends UUID ? Uuid : T extends DATE | DATETIME | DATETIMEOFFSET ? Date : T extends TIME ? Time : T extends BOOLEAN ? boolean : T extends BINARY ? Binary : T extends ROWFLAG ? any : T extends JSON ? M : T extends Raw ? Scalar : T extends LIST ? M[] : never; /** * 从TS Type 转换为DbType的类型 */ export declare type DbTypeFromScalar = T extends string ? STRING : T extends number ? DECIMAL | FLOAT32 | FLOAT64 | INT16 | INT8 | INT32 | INT64 : T extends Date ? DATETIME | DATE | DATETIMEOFFSET : T extends Time ? TIME : T extends boolean ? BOOLEAN : T extends Binary ? BINARY : T extends bigint ? INT64 : T extends Uuid ? UUID : T extends Decimal ? DECIMAL : T extends List ? DbTypeFromScalar extends BaseScalar ? LIST> : never : T extends Json ? JSON : never; /** * 数据库标准类型定义 */ export declare const DbType: { int8: INT8; int16: INT16 & (() => INT16); int32: INT32 & (() => INT32); int64: INT64 & (() => INT64); decimal: DECIMAL & ((precision: number, digit?: number | undefined) => DECIMAL); float32: FLOAT32 & (() => FLOAT32); float64: FLOAT64 & (() => FLOAT64); date: DATE & (() => DATE); time: TIME & (() => TIME); datetime: DATETIME & (() => DATETIME); datetimeoffset: DATETIMEOFFSET & (() => DATETIMEOFFSET); boolean: BOOLEAN & (() => BOOLEAN); uuid: UUID & (() => UUID); rowflag: ROWFLAG & (() => ROWFLAG); string: STRING & ((size: number) => STRING); binary: BINARY & ((size: number) => BINARY); json: JSON & (() => JSON); list: LIST & ((innerType: T_1) => LIST>); raw(name: string): any; MAX: number; }; import { Raw } from './raw';