Skip to content

Tagged

Tagged represents a custom value identified by an integer from 0 to 264-1.

Import

import { Tagged } from "@tai-kun/surrealdb/cbor";

.constructor()

new Tagged<T>(tag: number | BigInt, value: T);

Arguments

tag

An integer value from 0 to 264-1 that identifies the tagged data item. Note that in JavaScript, use BigInt for numbers exceeding 253-1.

value

The value of the tagged data item.

Return Value

When called with new, Tagged returns its instance.

.tag instance property

.tag is a property holding an integer value from 0 to 264-1 that identifies the tagged data item.

.value instance property

.value is a property storing the value of the tagged data item.

.toCBOR() instance method

.toCBOR() is a function that returns information for encoding into CBOR.

toCBOR(): [tag: number | bigint, value: unknown];

Arguments

None.

Return Value

Returns the information necessary for CBOR encoding.

Remarks

See also: