granularity

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	All           Simple = "all"
	None                 = "none"
	Second               = "second"
	Minute               = "minute"
	FifteenMinute        = "fifteen_minute"
	ThirtyMinute         = "thirty_minute"
	Hour                 = "hour"
	Day                  = "day"
	Week                 = "week"
	Month                = "month"
	Quarter              = "quarter"
	Year                 = "year"
)

Variables

This section is empty.

Functions

func Load

func Load(data []byte) (builder.Granularity, error)

Load converts the druid native query to builder.Granularity

Types

type Base

type Base struct {
	Typ string `json:"type,omitempty"`
}

Base is the base for granularity.

func (*Base) SetType

func (b *Base) SetType(typ string) *Base

SetType sets type.

func (*Base) Type

func (b *Base) Type() builder.ComponentType

Type returns the type.

type Duration

type Duration struct {
	Base
	Duration time.Duration `json:"duration,omitempty"`
	Origin   time.Time     `json:"origin,omitempty"`
}

Duration granularity is specified as an exact duration in milliseconds and timestamps are returned as UTC. Duration granularity values are in millis. https://druid.apache.org/docs/latest/querying/granularities.html#duration-granularities

func NewDuration

func NewDuration() *Duration

NewDuration creates new Duration.

func (*Duration) SetDuration

func (d *Duration) SetDuration(duration time.Duration) *Duration

SetDuration sets duration.

func (*Duration) SetOrigin

func (d *Duration) SetOrigin(origin time.Time) *Duration

SetOrigin sets the origin

type Period

type Period struct {
	Base
	Period   time.Duration      `json:"period,omitempty"`
	Origin   time.Time          `json:"origin,omitempty"`
	TimeZone types.DateTimeZone `json:"timeZone,omitempty"`
}

Period granularity is specified as arbitrary period combinations of years, months, weeks, hours, minutes and seconds (e.g. P2W, P3M, PT1H30M, PT0.750S) in ISO8601 format. https://druid.apache.org/docs/latest/querying/granularities.html#period-granularities

func NewPeriod

func NewPeriod() *Period

NewPeriod creates a Period type.

func (*Period) SetOrigin

func (p *Period) SetOrigin(origin time.Time) *Period

SetOrigin sets origin.

func (*Period) SetPeriod

func (p *Period) SetPeriod(period time.Duration) *Period

SetPeriod sets period.

func (*Period) SetTimeZone

func (p *Period) SetTimeZone(timeZone types.DateTimeZone) *Period

SetTimeZone sets timezone.

type Simple

type Simple string

Simple granularities are specified as a string and bucket timestamps by their UTC time. https://druid.apache.org/docs/latest/querying/granularities.html#simple-granularities

func NewSimple

func NewSimple() *Simple

NewSimple creates a Simple type.

func (*Simple) SetGranularity

func (s *Simple) SetGranularity(g Simple) *Simple

SetGranularity sets granularity.

func (*Simple) Type

func (s *Simple) Type() builder.ComponentType

Type sets the type to Simple

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL