Skip to content

meos.js


meos.js / TsTzSpan

Class: TsTzSpan

Defined in: core/types/collections/time/TsTzSpan.ts:31

A contiguous range of timestamps with timezone.

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

Example

ts
const s = TsTzSpan.fromString('[2020-01-01, 2020-12-31]');
console.log(s.lower()); // microseconds since 2000-01-01 UTC
console.log(s.durationMs()); // duration in milliseconds
s.free();

Extends

Constructors

Constructor

ts
new TsTzSpan(inner): TsTzSpan;

Defined in: core/types/collections/base/Span.ts:45

Parameters

inner

number

Returns

TsTzSpan

Inherited from

Span.constructor

Accessors

inner

Get Signature

ts
get inner(): number;

Defined in: core/types/collections/base/Span.ts:57

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

Returns

number

Inherited from

Span.inner

Methods

[dispose]()

ts
dispose: void;

Defined in: core/types/collections/base/Span.ts:67

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

Returns

void

Inherited from

Span.[dispose]


asHexWKB()

ts
asHexWKB(variant?): string;

Defined in: core/types/collections/base/Span.ts:90

Serialises this span to a hex-encoded WKB string.

Parameters

variant?

number = 4

WKB encoding variant (default 4 = Extended WKB).

Returns

string

Inherited from

Span.asHexWKB


contains()

ts
contains(other): boolean;

Defined in: core/types/collections/base/Span.ts:149

true if this entirely contains other.

Parameters

other

this

Returns

boolean

Inherited from

Span.contains


copy()

ts
copy(): this;

Defined in: core/types/collections/base/Span.ts:75

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

Returns

this

Inherited from

Span.copy


distance()

ts
distance(other): number;

Defined in: core/types/collections/time/TsTzSpan.ts:116

Returns the distance (gap) between this and other in microseconds. Returns 0 if they overlap or are adjacent.

Parameters

other

this

Returns

number

Overrides

Span.distance


durationMs()

ts
durationMs(): number;

Defined in: core/types/collections/time/TsTzSpan.ts:92

Returns the duration of this span in milliseconds ((upper - lower) / 1000).

Returns

number


eq()

ts
eq(other): boolean;

Defined in: core/types/collections/base/Span.ts:233

true if this and other have identical bounds and inclusivity.

Parameters

other

this

Returns

boolean

Inherited from

Span.eq


expand()

ts
expand(interval): TsTzSpan;

Defined in: core/types/collections/time/TsTzSpan.ts:137

Returns a new span expanded by the given interval on each side.

Parameters

interval

number

Raw WASM pointer to a MEOS interval.

Returns

TsTzSpan


free()

ts
free(): void;

Defined in: core/types/collections/base/Span.ts:62

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

Returns

void

Inherited from

Span.free


ge()

ts
ge(other): boolean;

Defined in: core/types/collections/base/Span.ts:258

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

Parameters

other

this

Returns

boolean

Inherited from

Span.ge


gt()

ts
gt(other): boolean;

Defined in: core/types/collections/base/Span.ts:253

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

Parameters

other

this

Returns

boolean

Inherited from

Span.gt


hash()

ts
hash(): number;

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

32-bit integer hash of this span.

Returns

number

Inherited from

Span.hash


intersection()

ts
intersection(other): TsTzSpan | null;

Defined in: core/types/collections/base/Span.ts:207

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

TsTzSpan | null

Inherited from

Span.intersection


isAdjacent()

ts
isAdjacent(other): boolean;

Defined in: core/types/collections/time/TsTzSpan.ts:104

true if this and other share exactly one boundary timestamp without overlapping. Uses the MEOS C-level adjacency check which handles half-open bound semantics correctly.

Parameters

other

this

Returns

boolean

Overrides

Span.isAdjacent


isAfter()

ts
isAfter(other): boolean;

Defined in: core/types/collections/base/Span.ts:176

true if every point in this is strictly greater than every point in other (no overlap).

Parameters

other

this

Returns

boolean

Inherited from

Span.isAfter


isBefore()

ts
isBefore(other): boolean;

Defined in: core/types/collections/base/Span.ts:163

true if every point in this is strictly less than every point in other (no overlap).

Parameters

other

this

Returns

boolean

Inherited from

Span.isBefore


isContainedIn()

ts
isContainedIn(other): boolean;

Defined in: core/types/collections/base/Span.ts:144

true if this is entirely contained within other.

Parameters

other

this

Returns

boolean

Inherited from

Span.isContainedIn


isOverOrAfter()

ts
isOverOrAfter(other): boolean;

Defined in: core/types/collections/base/Span.ts:184

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

Parameters

other

this

Returns

boolean

Inherited from

Span.isOverOrAfter


isOverOrBefore()

ts
isOverOrBefore(other): boolean;

Defined in: core/types/collections/base/Span.ts:171

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

Parameters

other

this

Returns

boolean

Inherited from

Span.isOverOrBefore


le()

ts
le(other): boolean;

Defined in: core/types/collections/base/Span.ts:248

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

Parameters

other

this

Returns

boolean

Inherited from

Span.le


lower()

ts
lower(): number;

Defined in: core/types/collections/time/TsTzSpan.ts:82

Returns the lower bound as microseconds since 2000-01-01 UTC.

Returns

number

Overrides

Span.lower


lowerInc()

ts
lowerInc(): boolean;

Defined in: core/types/collections/base/Span.ts:111

true if the lower bound is inclusive ([).

Returns

boolean

Inherited from

Span.lowerInc


lt()

ts
lt(other): boolean;

Defined in: core/types/collections/base/Span.ts:243

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

Parameters

other

this

Returns

boolean

Inherited from

Span.lt


minus()

ts
minus(other): number;

Defined in: core/types/collections/base/Span.ts:216

Returns the part of this that is not in other as a raw WASM pointer. The result may represent a SpanSet when the subtraction splits this span into two parts.

Parameters

other

this

Returns

number

Inherited from

Span.minus


ne()

ts
ne(other): boolean;

Defined in: core/types/collections/base/Span.ts:238

true if this and other differ in at least one bound or inclusivity.

Parameters

other

this

Returns

boolean

Inherited from

Span.ne


overlaps()

ts
overlaps(other): boolean;

Defined in: core/types/collections/base/Span.ts:154

true if this and other share at least one point.

Parameters

other

this

Returns

boolean

Inherited from

Span.overlaps


shiftScale()

ts
shiftScale(shift, duration): TsTzSpan;

Defined in: core/types/collections/time/TsTzSpan.ts:129

Returns a new span 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

TsTzSpan


toDateSpan()

ts
toDateSpan(): number;

Defined in: core/types/collections/time/TsTzSpan.ts:158

Converts this span to a DateSpan (timestamps truncated to midnight UTC) and returns the raw WASM pointer. Use new DateSpan(ptr) to obtain a typed object.

Returns

number


toSpanSet()

ts
toSpanSet(): number;

Defined in: core/types/collections/base/Span.ts:129

Wraps this span in a one-element SpanSet and returns the raw WASM pointer. Use the appropriate SpanSet constructor (e.g. new IntSpanSet(ptr)) to obtain a typed object.

Returns

number

Inherited from

Span.toSpanSet


toString()

ts
toString(): string;

Defined in: core/types/collections/time/TsTzSpan.ts:77

Returns the WKT string representation (e.g. [2020-01-01 00:00:00+00, 2020-12-31 00:00:00+00]).

Returns

string

Overrides

Span.toString


tprecision()

ts
tprecision(duration, origin): TsTzSpan;

Defined in: core/types/collections/time/TsTzSpan.ts:146

Returns a new span snapped to the nearest multiple of duration starting 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

TsTzSpan


union()

ts
union(other): number;

Defined in: core/types/collections/base/Span.ts:224

Returns the union of this and other as a raw WASM pointer. The spans do not need to be adjacent or overlapping.

Parameters

other

this

Returns

number

Inherited from

Span.union


upper()

ts
upper(): number;

Defined in: core/types/collections/time/TsTzSpan.ts:87

Returns the upper bound as microseconds since 2000-01-01 UTC.

Returns

number

Overrides

Span.upper


upperInc()

ts
upperInc(): boolean;

Defined in: core/types/collections/base/Span.ts:116

true if the upper bound is inclusive (]).

Returns

boolean

Inherited from

Span.upperInc


fromHexWKB()

ts
static fromHexWKB(hexwkb): TsTzSpan;

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

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

Parameters

hexwkb

string

Hex-encoded WKB string.

Returns

TsTzSpan


fromString()

ts
static fromString(str): TsTzSpan;

Defined in: core/types/collections/time/TsTzSpan.ts:44

Parses a TsTzSpan from its WKT string representation.

Parameters

str

string

WKT string, e.g. "[2020-01-01, 2020-12-31]".

Returns

TsTzSpan


fromTimestamps()

ts
static fromTimestamps(
   lower, 
   upper, 
   lowerInc?, 
   upperInc?): TsTzSpan;

Defined in: core/types/collections/time/TsTzSpan.ts:55

Creates a TsTzSpan from explicit timestamp bounds.

Parameters

lower

number

Lower bound as microseconds since 2000-01-01 UTC.

upper

number

Upper bound as microseconds since 2000-01-01 UTC.

lowerInc?

boolean = true

true for inclusive lower bound [ (default).

upperInc?

boolean = false

true for inclusive upper bound ] (default false).

Returns

TsTzSpan