Home Identifier Source
import Generator from '@esnet/pond/src/generator.js'
public class | source

Generator

A BucketGenerator

To use a BucketGenerator you supply the size of the buckets you want e.g. "1h" for hourly. Then you call bucket() as needed, each time with a date. The bucket containing that date will be returned.

Buckets can then be used to aggregate data.

Static Method Summary

Static Public Methods
public static

getBucketPosFromDate(date: *, length: *): *

public static

getLengthFromSize(size: *): *

Takes the size (e.g.

Constructor Summary

Public Constructor
public

constructor(size: *)

Method Summary

Public Methods
public

bucket(date: *): *

Date in is assumed to be local and that the bucket will be

public

bucketIndex(date: *): *

public

bucketIndexList(date1: *, date2: *): *

public

bucketList(date1: *, date2: *): *

Static Public Methods

public static getBucketPosFromDate(date: *, length: *): * source

Params:

NameTypeAttributeDescription
date *
length *

Return:

*

public static getLengthFromSize(size: *): * source

Takes the size (e.g. 1d, 6h, 5m, 30s) and returns the length of the bucket in ms.

Params:

NameTypeAttributeDescription
size *

Return:

*

Public Constructors

public constructor(size: *) source

Params:

NameTypeAttributeDescription
size *

Public Methods

public bucket(date: *): * source

Date in is assumed to be local and that the bucket will be created in UTC time. Note that this doesn't really matter for seconds, minutes, or hours. But days will be offset from midnight to midnight, depending on local timezone.

Params:

NameTypeAttributeDescription
date *

Return:

*

public bucketIndex(date: *): * source

Params:

NameTypeAttributeDescription
date *

Return:

*

public bucketIndexList(date1: *, date2: *): * source

Params:

NameTypeAttributeDescription
date1 *
date2 *

Return:

*

public bucketList(date1: *, date2: *): * source

Params:

NameTypeAttributeDescription
date1 *
date2 *

Return:

*