AK-21/Graphite-Industrial-Intelligence
0
1import type { ColumnBuilderBaseConfig } from "../../column-builder.js";2import type { ColumnBaseConfig } from "../../column.js";3import { entityKind } from "../../entity.js";4import { type Equal } from "../../utils.js";5import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";6type BlobMode = 'buffer' | 'json' | 'bigint';7export type SQLiteBigIntBuilderInitial<TName extends string> = SQLiteBigIntBuilder<{8 name: TName;9 dataType: 'bigint';10 columnType: 'SQLiteBigInt';11 data: bigint;12 driverParam: Buffer;13 enumValues: undefined;14}>;15export declare class SQLiteBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint', 'SQLiteBigInt'>> extends SQLiteColumnBuilder<T> {16 static readonly [entityKind]: string;17 constructor(name: T['name']);18}19export declare class SQLiteBigInt<T extends ColumnBaseConfig<'bigint', 'SQLiteBigInt'>> extends SQLiteColumn<T> {20 static readonly [entityKind]: string;21 getSQLType(): string;22 mapFromDriverValue(value: Buffer | Uint8Array | ArrayBuffer): bigint;23 mapToDriverValue(value: bigint): Buffer;24}25export type SQLiteBlobJsonBuilderInitial<TName extends string> = SQLiteBlobJsonBuilder<{26 name: TName;27 dataType: 'json';28 columnType: 'SQLiteBlobJson';29 data: unknown;30 driverParam: Buffer;31 enumValues: undefined;32}>;33export declare class SQLiteBlobJsonBuilder<T extends ColumnBuilderBaseConfig<'json', 'SQLiteBlobJson'>> extends SQLiteColumnBuilder<T> {34 static readonly [entityKind]: string;35 constructor(name: T['name']);36}37export declare class SQLiteBlobJson<T extends ColumnBaseConfig<'json', 'SQLiteBlobJson'>> extends SQLiteColumn<T> {38 static readonly [entityKind]: string;39 getSQLType(): string;40 mapFromDriverValue(value: Buffer | Uint8Array | ArrayBuffer): T['data'];41 mapToDriverValue(value: T['data']): Buffer;42}43export type SQLiteBlobBufferBuilderInitial<TName extends string> = SQLiteBlobBufferBuilder<{44 name: TName;45 dataType: 'buffer';46 columnType: 'SQLiteBlobBuffer';47 data: Buffer;48 driverParam: Buffer;49 enumValues: undefined;50}>;51export declare class SQLiteBlobBufferBuilder<T extends ColumnBuilderBaseConfig<'buffer', 'SQLiteBlobBuffer'>> extends SQLiteColumnBuilder<T> {52 static readonly [entityKind]: string;53 constructor(name: T['name']);54}55export declare class SQLiteBlobBuffer<T extends ColumnBaseConfig<'buffer', 'SQLiteBlobBuffer'>> extends SQLiteColumn<T> {56 static readonly [entityKind]: string;57 mapFromDriverValue(value: Buffer | Uint8Array | ArrayBuffer): T['data'];58 getSQLType(): string;59}60export interface BlobConfig<TMode extends BlobMode = BlobMode> {61 mode: TMode;62}63/**64 * It's recommended to use `text('...', { mode: 'json' })` instead of `blob` in JSON mode, because it supports JSON functions:65 * >All JSON functions currently throw an error if any of their arguments are BLOBs because BLOBs are reserved for a future enhancement in which BLOBs will store the binary encoding for JSON.66 *67 * https://www.sqlite.org/json1.html68 */69export declare function blob(): SQLiteBlobJsonBuilderInitial<''>;70export declare function blob<TMode extends BlobMode = BlobMode>(config?: BlobConfig<TMode>): Equal<TMode, 'bigint'> extends true ? SQLiteBigIntBuilderInitial<''> : Equal<TMode, 'buffer'> extends true ? SQLiteBlobBufferBuilderInitial<''> : SQLiteBlobJsonBuilderInitial<''>;71export declare function blob<TName extends string, TMode extends BlobMode = BlobMode>(name: TName, config?: BlobConfig<TMode>): Equal<TMode, 'bigint'> extends true ? SQLiteBigIntBuilderInitial<TName> : Equal<TMode, 'buffer'> extends true ? SQLiteBlobBufferBuilderInitial<TName> : SQLiteBlobJsonBuilderInitial<TName>;72export {};73 