Skip to content

meos.js


meos.js / TsTzSet

Class: TsTzSet

Defined in: core/types/collections/time/TsTzSet.ts:29

An ordered set of distinct timestamps with timezone.

Timestamps are represented as TimestampTz integers (microseconds since 2000-01-01 UTC).

Example

ts
const s = TsTzSet.fromString('{2020-01-01, 2020-06-15, 2020-12-31}');
console.log(s.numValues());  // 3
console.log(s.startValue()); // microseconds since 2000-01-01 UTC
s.free();

Extends

Constructors

Constructor

ts
new TsTzSet(inner): TsTzSet;

Defined in: core/types/collections/base/MeosSet.ts:46

Parameters

inner

number

Returns

TsTzSet

Inherited from

MeosSet.constructor

Accessors

inner

Get Signature

ts
get inner(): number;

Defined in: core/types/collections/base/MeosSet.ts:58

Raw WASM heap pointer. Do not free this value directly; use free.

Returns

number

Inherited from

MeosSet.inner

Methods

[dispose]()

ts
dispose: void;

Defined in: core/types/collections/base/MeosSet.ts:68

Implements the using resource-management protocol — calls free automatically.

Returns

void

Inherited from

MeosSet.[dispose]


asHexWKB()

ts
asHexWKB(variant?): string;

Defined in: core/types/collections/base/MeosSet.ts:91

Serialises this set to a hex-encoded WKB string.

Parameters

variant?

number = 4

WKB encoding variant (default 4 = Extended WKB).

Returns

string

Inherited from

MeosSet.asHexWKB


contains()

ts
contains(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:147

true if this contains every element of other.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.contains


copy()

ts
copy(): this;

Defined in: core/types/collections/base/MeosSet.ts:76

Returns a deep copy of this set. The caller is responsible for calling free on the returned copy.

Returns

this

Inherited from

MeosSet.copy


distance()

ts
distance(other): number;

Defined in: core/types/collections/time/TsTzSet.ts:93

Returns the distance (gap) between this and other in microseconds. Returns 0 if they share at least one timestamp.

Parameters

other

TsTzSet

Returns

number

Overrides

MeosSet.distance


endValue()

ts
endValue(): number;

Defined in: core/types/collections/time/TsTzSet.ts:73

Returns the latest timestamp in this set as microseconds since 2000-01-01 UTC.

Returns

number

Overrides

MeosSet.endValue


eq()

ts
eq(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:232

true if this and other contain the same elements.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.eq


free()

ts
free(): void;

Defined in: core/types/collections/base/MeosSet.ts:63

Releases the WASM-allocated memory. Must be called when the object is no longer needed.

Returns

void

Inherited from

MeosSet.free


ge()

ts
ge(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:257

true if this is greater than or equal to other in MEOS total ordering.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.ge


gt()

ts
gt(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:252

true if this is strictly greater than other in MEOS total ordering.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.gt


hash()

ts
hash(): number;

Defined in: core/types/collections/base/MeosSet.ts:105

32-bit integer hash of this set.

Returns

number

Inherited from

MeosSet.hash


intersection()

ts
intersection(other): TsTzSet | null;

Defined in: core/types/collections/base/MeosSet.ts:205

Returns the intersection of this and other, or null if they are disjoint. The caller is responsible for calling free on the result.

Parameters

other

this

Returns

TsTzSet | null

Inherited from

MeosSet.intersection


isAfter()

ts
isAfter(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:174

true if every element of this is strictly greater than every element of other.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.isAfter


isBefore()

ts
isBefore(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:161

true if every element of this is strictly less than every element of other.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.isBefore


isContainedIn()

ts
isContainedIn(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:142

true if this is entirely contained within other (every element of this is in other).

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.isContainedIn


isOverOrAfter()

ts
isOverOrAfter(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:182

true if this does not extend to the left of other (i.e. min(this) ≥ min(other)).

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.isOverOrAfter


isOverOrBefore()

ts
isOverOrBefore(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:169

true if this does not extend to the right of other (i.e. max(this) ≤ max(other)).

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.isOverOrBefore


le()

ts
le(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:247

true if this is less than or equal to other in MEOS total ordering.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.le


lt()

ts
lt(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:242

true if this is strictly less than other in MEOS total ordering.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.lt


minus()

ts
minus(other): TsTzSet | null;

Defined in: core/types/collections/base/MeosSet.ts:214

Returns the part of this not in other, or null if the result is empty. The caller is responsible for calling free on the result.

Parameters

other

this

Returns

TsTzSet | null

Inherited from

MeosSet.minus


ne()

ts
ne(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:237

true if this and other differ in at least one element.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.ne


numValues()

ts
numValues(): number;

Defined in: core/types/collections/base/MeosSet.ts:100

Number of elements in this set.

Returns

number

Inherited from

MeosSet.numValues


overlaps()

ts
overlaps(other): boolean;

Defined in: core/types/collections/base/MeosSet.ts:152

true if this and other share at least one element.

Parameters

other

this

Returns

boolean

Inherited from

MeosSet.overlaps


shiftScale()

ts
shiftScale(shift, duration): TsTzSet;

Defined in: core/types/collections/time/TsTzSet.ts:118

Returns a new set shifted and/or scaled along the time axis.

Parameters

shift

number

Raw WASM pointer to a MEOS interval for the shift amount (0 to skip).

duration

number

Raw WASM pointer to a MEOS interval for the new duration (0 to skip).

Returns

TsTzSet


startValue()

ts
startValue(): number;

Defined in: core/types/collections/time/TsTzSet.ts:68

Returns the earliest timestamp in this set as microseconds since 2000-01-01 UTC.

Returns

number

Overrides

MeosSet.startValue


toDateSet()

ts
toDateSet(): number;

Defined in: core/types/collections/time/TsTzSet.ts:105

Truncates each timestamp to midnight UTC and returns the raw WASM pointer. Use new DateSet(ptr) to obtain a typed object.

Returns

number


toSpan()

ts
toSpan(): number;

Defined in: core/types/collections/base/MeosSet.ts:113

Returns the bounding span of this set as a raw WASM pointer. Use the appropriate Span constructor to obtain a typed object.

Returns

number

Inherited from

MeosSet.toSpan


toSpanSet()

ts
toSpanSet(): number;

Defined in: core/types/collections/base/MeosSet.ts:121

Returns this set converted to a SpanSet as a raw WASM pointer. Use the appropriate SpanSet constructor to obtain a typed object.

Returns

number

Inherited from

MeosSet.toSpanSet


toString()

ts
toString(): string;

Defined in: core/types/collections/time/TsTzSet.ts:59

Returns the WKT string representation (e.g. {2020-01-01 00:00:00+00, ...}).

Returns

string

Overrides

MeosSet.toString


tprecision()

ts
tprecision(duration, origin): TsTzSet;

Defined in: core/types/collections/time/TsTzSet.ts:127

Returns a new set with each timestamp snapped to the nearest multiple of duration from origin.

Parameters

duration

number

Raw WASM pointer to a MEOS interval defining the bucket size.

origin

number

Reference timestamp in microseconds since 2000-01-01 UTC.

Returns

TsTzSet


union()

ts
union(other): this;

Defined in: core/types/collections/base/MeosSet.ts:223

Returns the union of this and other. The caller is responsible for calling free on the result.

Parameters

other

this

Returns

this

Inherited from

MeosSet.union


valueN()

ts
valueN(n): number;

Defined in: core/types/collections/time/TsTzSet.ts:81

Returns the n-th timestamp (0-based index) as microseconds since 2000-01-01 UTC.

Parameters

n

number

0-based index (MEOS internally uses 1-based indexing).

Returns

number

Overrides

MeosSet.valueN


fromHexWKB()

ts
static fromHexWKB(hexwkb): TsTzSet;

Defined in: core/types/collections/time/TsTzSet.ts:50

Deserialises a TsTzSet from a hex-encoded WKB string produced by asHexWKB.

Parameters

hexwkb

string

Hex-encoded WKB string.

Returns

TsTzSet


fromString()

ts
static fromString(str): TsTzSet;

Defined in: core/types/collections/time/TsTzSet.ts:42

Parses a TsTzSet from its WKT string representation.

Parameters

str

string

WKT string, e.g. "{2020-01-01, 2020-06-15, 2020-12-31}".

Returns

TsTzSet