UNPKG

gnablib

Version:

A lean, zero dependency library to provide a useful base for your project.

52 lines (51 loc) 2.06 kB
/*! Copyright 2023-2025 the gnablib contributors MPL-1.1 */ import { ColType } from './ColType.js'; import { ACudColType } from './ACudColType.js'; import type { IValid } from '../interfaces/IValid.js'; import { TableName } from '../TableName.js'; import { ColName } from '../ColName.js'; import { FromBinResult } from '../../primitive/FromBinResult.js'; import { IProblem } from '../../error/probs/interfaces/IProblem.js'; import { I64 } from '../../primitive/number/I64.js'; export declare abstract class ARef extends ACudColType implements IValid<number | I64> { protected abstract get _maxByteLen(): number; protected abstract get _max64(): I64; protected abstract get _cudPrefix(): string; readonly table: TableName; readonly column: ColName; constructor(table: TableName, column: ColName, nullable?: boolean); get cudType(): string; cudByteSize(): number; valid(input?: number | I64): IProblem | undefined; toBin(): Uint8Array; unknownBin(value?: number | I64): Uint8Array; binUnknown(bin: Uint8Array, pos: number): FromBinResult<I64 | undefined>; static fromBinSub(colByte: number, nullable: boolean, len: number, bin: Uint8Array, pos: number): FromBinResult<ARef>; } export declare class Ref2 extends ARef { readonly _colType = ColType.Ref2; readonly _maxByteLen = 2; readonly _max64: I64; readonly _cudPrefix = "ref2"; readonly mysqlType = "SMALLINT"; readonly sqliteType = "INT2"; readonly postgresType = "smallint"; } export declare class Ref4 extends ARef { readonly _colType = ColType.Ref4; readonly _maxByteLen = 4; readonly _max64: I64; readonly _cudPrefix = "ref4"; readonly mysqlType = "INT"; readonly sqliteType = "INT"; readonly postgresType = "integer"; } export declare class Ref8 extends ARef { readonly _colType = ColType.Ref8; readonly _maxByteLen = 8; readonly _max64: I64; readonly _cudPrefix = "ref8"; readonly mysqlType = "BIGINT"; readonly sqliteType = "BIGINT"; readonly postgresType = "bigint"; }