datetime

package
v0.0.0-...-f7e61ff Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package datetime provides comprehensive temporal data handling for Golars. It includes support for dates, times, timestamps, durations, timezones, and various calendar operations that integrate seamlessly with the DataFrame and Series APIs.

The package supports nanosecond precision timestamps, timezone-aware operations, business day calculations, and flexible parsing/formatting capabilities.

Example:

df := golars.NewDataFrame(
    golars.NewDateTimeSeries("timestamp", []time.Time{
        time.Now(),
        time.Now().Add(24 * time.Hour),
        time.Now().Add(48 * time.Hour),
    }),
)

result := df.WithColumn("year",
    golars.Col("timestamp").Dt().Year(),
).WithColumn("is_weekend",
    golars.Col("timestamp").Dt().IsWeekend(),
)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractDay

func ExtractDay(timestamps []int64, tz *time.Location) []int8

func ExtractHour

func ExtractHour(timestamps []int64, tz *time.Location) []int8

func ExtractMinute

func ExtractMinute(timestamps []int64, tz *time.Location) []int8

func ExtractMonth

func ExtractMonth(timestamps []int64, tz *time.Location) []int8

func ExtractSecond

func ExtractSecond(timestamps []int64, tz *time.Location) []int8

func ExtractYear

func ExtractYear(timestamps []int64, tz *time.Location) []int32

func FormatDuration

func FormatDuration(d Duration) string

func FormatWithPolarsStyle

func FormatWithPolarsStyle(dt DateTime, format string) string

func LoadTimezone

func LoadTimezone(name string) (*time.Location, error)

LoadTimezone loads a timezone by name

func NewDateSeries

func NewDateSeries(name string, values []time.Time) series.Series

NewDateSeries creates a new Date series from time.Time values

func NewDateSeriesFromStrings

func NewDateSeriesFromStrings(name string, values []string, format string) (series.Series, error)

NewDateSeriesFromStrings creates a Date series from string values

func NewDateTimeSeries

func NewDateTimeSeries(name string, values []time.Time) series.Series

NewDateTimeSeries creates a new DateTime series from time.Time values

func NewDateTimeSeriesFromEpoch

func NewDateTimeSeriesFromEpoch(name string, values []int64, unit TimeUnit) series.Series

NewDateTimeSeriesFromEpoch creates a DateTime series from epoch values

func NewDateTimeSeriesFromStrings

func NewDateTimeSeriesFromStrings(name string, values []string, format string) (series.Series, error)

NewDateTimeSeriesFromStrings creates a DateTime series from string values

func NewTimeSeries

func NewTimeSeries(name string, hours, minutes, seconds []int) (series.Series, error)

NewTimeSeries creates a new Time series

func StrToDate

func StrToDate(e expr.Expr, format string) expr.Expr

StrToDate converts a string expression to date

func StrToDateTime

func StrToDateTime(e expr.Expr, format string) expr.Expr

StrToDateTime converts a string expression to datetime

func StrToTime

func StrToTime(e expr.Expr, format string) expr.Expr

StrToTime converts a string expression to time

Types

type Date

type Date struct {
	// contains filtered or unexported fields
}

Date represents a calendar date without time

func NewDate

func NewDate(year int, month time.Month, day int) Date

NewDate creates a new Date

func NewDateFromTime

func NewDateFromTime(t time.Time) Date

NewDateFromTime creates a Date from a time.Time

func ParseDate

func ParseDate(value string) (Date, error)

func ParseDateWithFormat

func ParseDateWithFormat(value string, format string) (Date, error)

func (Date) Add

func (d Date) Add(days int) Date

Add adds days to the date

func (Date) Day

func (d Date) Day() int

Day returns the day of month

func (Date) Format

func (d Date) Format(layout string) string

func (Date) ISOFormat

func (d Date) ISOFormat() string

func (Date) IsWeekend

func (d Date) IsWeekend() bool

func (Date) Month

func (d Date) Month() time.Month

Month returns the month

func (Date) String

func (d Date) String() string

func (Date) Time

func (d Date) Time() time.Time

Time returns the time.Time representation at midnight UTC

func (Date) Year

func (d Date) Year() int

Year returns the year

type DateRangeBuilder

type DateRangeBuilder struct {
	// contains filtered or unexported fields
}

func NewDateRangeBuilder

func NewDateRangeBuilder() *DateRangeBuilder

func (*DateRangeBuilder) Build

func (b *DateRangeBuilder) Build() ([]DateTime, error)

func (*DateRangeBuilder) Closed

func (*DateRangeBuilder) Count

func (b *DateRangeBuilder) Count(n int) *DateRangeBuilder

func (*DateRangeBuilder) End

func (*DateRangeBuilder) Frequency

func (b *DateRangeBuilder) Frequency(freq Duration) *DateRangeBuilder

func (*DateRangeBuilder) Inclusive

func (b *DateRangeBuilder) Inclusive(inc string) *DateRangeBuilder

func (*DateRangeBuilder) Start

func (*DateRangeBuilder) Timezone

func (b *DateRangeBuilder) Timezone(tz *time.Location) *DateRangeBuilder

type DateTime

type DateTime struct {
	// contains filtered or unexported fields
}

DateTime represents a point in time with timezone information

func BusinessDayRange

func BusinessDayRange(start, end time.Time) ([]DateTime, error)

func DateRange

func DateRange(start, end time.Time, freq Duration) ([]DateTime, error)

func DateRangeFromString

func DateRangeFromString(start, end string, freq string) ([]DateTime, error)

func DateRangeWithCount

func DateRangeWithCount(start time.Time, freq Duration, count int) ([]DateTime, error)

func NewDateTime

func NewDateTime(t time.Time) DateTime

NewDateTime creates a new DateTime

func ParseDateTime

func ParseDateTime(value string) (DateTime, error)

func ParseDateTimeFromEpoch

func ParseDateTimeFromEpoch(epoch int64, unit TimeUnit) DateTime

func ParseDateTimeWithFormat

func ParseDateTimeWithFormat(value string, format string) (DateTime, error)

func ParseDateTimeWithTimezone

func ParseDateTimeWithTimezone(value string, tz *time.Location) (DateTime, error)

func (DateTime) Add

func (dt DateTime) Add(d Duration) DateTime

Add adds a duration to the DateTime

func (DateTime) Ceil

func (dt DateTime) Ceil(unit TimeUnit) DateTime

func (DateTime) ConvertTimezone

func (dt DateTime) ConvertTimezone(tz *time.Location) DateTime

ConvertTimezone converts a DateTime to a different timezone

func (DateTime) Day

func (dt DateTime) Day() int

func (DateTime) DayOfWeek

func (dt DateTime) DayOfWeek() int

func (DateTime) DayOfYear

func (dt DateTime) DayOfYear() int

func (DateTime) Floor

func (dt DateTime) Floor(unit TimeUnit) DateTime

func (DateTime) Format

func (dt DateTime) Format(layout string) string

func (DateTime) Hour

func (dt DateTime) Hour() int

func (DateTime) ISOFormat

func (dt DateTime) ISOFormat() string

func (DateTime) ISOYear

func (dt DateTime) ISOYear() int

func (DateTime) InTimezone

func (dt DateTime) InTimezone(tzName string) (DateTime, error)

InTimezone converts the DateTime to the specified timezone

func (DateTime) IsLeapYear

func (dt DateTime) IsLeapYear() bool

func (DateTime) IsMonthEnd

func (dt DateTime) IsMonthEnd() bool

func (DateTime) IsMonthStart

func (dt DateTime) IsMonthStart() bool

func (DateTime) IsQuarterEnd

func (dt DateTime) IsQuarterEnd() bool

func (DateTime) IsQuarterStart

func (dt DateTime) IsQuarterStart() bool

func (DateTime) IsWeekend

func (dt DateTime) IsWeekend() bool

func (DateTime) IsYearEnd

func (dt DateTime) IsYearEnd() bool

func (DateTime) IsYearStart

func (dt DateTime) IsYearStart() bool

func (DateTime) Microsecond

func (dt DateTime) Microsecond() int

func (DateTime) Millisecond

func (dt DateTime) Millisecond() int

func (DateTime) Minute

func (dt DateTime) Minute() int

func (DateTime) Month

func (dt DateTime) Month() time.Month

func (DateTime) Nanosecond

func (dt DateTime) Nanosecond() int

func (DateTime) Quarter

func (dt DateTime) Quarter() int

func (DateTime) Round

func (dt DateTime) Round(unit TimeUnit) DateTime

func (DateTime) Second

func (dt DateTime) Second() int

func (DateTime) String

func (dt DateTime) String() string

func (DateTime) Sub

func (dt DateTime) Sub(d Duration) DateTime

Sub subtracts a duration from the DateTime

func (DateTime) Time

func (dt DateTime) Time() time.Time

Time returns the Go time.Time representation

func (DateTime) ToLocal

func (dt DateTime) ToLocal() DateTime

ToLocal converts the DateTime to the local timezone

func (DateTime) ToTimezone

func (dt DateTime) ToTimezone(tz *time.Location) DateTime

ToTimezone converts the DateTime to a different timezone (different instant)

func (DateTime) ToUTC

func (dt DateTime) ToUTC() DateTime

ToUTC converts the DateTime to UTC

func (DateTime) Truncate

func (dt DateTime) Truncate(unit TimeUnit) DateTime

func (DateTime) WeekOfYear

func (dt DateTime) WeekOfYear() int

func (DateTime) WithTimezone

func (dt DateTime) WithTimezone(tz *time.Location) DateTime

WithTimezone returns a new DateTime with the specified timezone without changing the underlying timestamp

func (DateTime) Year

func (dt DateTime) Year() int

type DateTimeAddExpr

type DateTimeAddExpr struct {
	// contains filtered or unexported fields
}

DateTimeAddExpr represents adding a duration to a datetime expression

func (*DateTimeAddExpr) Alias

func (e *DateTimeAddExpr) Alias(name string) expr.Expr

func (*DateTimeAddExpr) DataType

func (e *DateTimeAddExpr) DataType() datatypes.DataType

func (*DateTimeAddExpr) IsColumn

func (e *DateTimeAddExpr) IsColumn() bool

func (*DateTimeAddExpr) Name

func (e *DateTimeAddExpr) Name() string

func (*DateTimeAddExpr) String

func (e *DateTimeAddExpr) String() string

type DateTimeArithmetic

type DateTimeArithmetic struct {
	// contains filtered or unexported fields
}

DateTimeArithmetic provides arithmetic operations for DateTime series

type DateTimeComponentExpr

type DateTimeComponentExpr struct {
	// contains filtered or unexported fields
}

DateTimeComponentExpr represents a datetime component extraction

func (*DateTimeComponentExpr) Alias

func (e *DateTimeComponentExpr) Alias(name string) expr.Expr

func (*DateTimeComponentExpr) DataType

func (*DateTimeComponentExpr) IsColumn

func (e *DateTimeComponentExpr) IsColumn() bool

func (*DateTimeComponentExpr) Name

func (e *DateTimeComponentExpr) Name() string

func (*DateTimeComponentExpr) String

func (e *DateTimeComponentExpr) String() string

type DateTimeDiffExpr

type DateTimeDiffExpr struct {
	// contains filtered or unexported fields
}

DateTimeDiffExpr represents the difference between two datetime expressions

func (*DateTimeDiffExpr) Alias

func (e *DateTimeDiffExpr) Alias(name string) expr.Expr

func (*DateTimeDiffExpr) DataType

func (e *DateTimeDiffExpr) DataType() datatypes.DataType

func (*DateTimeDiffExpr) IsColumn

func (e *DateTimeDiffExpr) IsColumn() bool

func (*DateTimeDiffExpr) Name

func (e *DateTimeDiffExpr) Name() string

func (*DateTimeDiffExpr) String

func (e *DateTimeDiffExpr) String() string

type DateTimeExpr

type DateTimeExpr struct {
	// contains filtered or unexported fields
}

DateTimeExpr provides datetime-specific operations on expressions

func DtExpr

func DtExpr(e expr.Expr) *DateTimeExpr

DtExpr returns datetime operations for an expression

func (*DateTimeExpr) Add

func (dte *DateTimeExpr) Add(duration Duration) expr.Expr

Add adds a duration to the datetime expression

func (*DateTimeExpr) Ceil

func (dte *DateTimeExpr) Ceil(unit TimeUnit) expr.Expr

Ceil rounds up to the nearest unit

func (*DateTimeExpr) ConvertTimezone

func (dte *DateTimeExpr) ConvertTimezone(tzName string) expr.Expr

ConvertTimezone creates an expression to convert datetime to a new timezone

func (*DateTimeExpr) Day

func (dte *DateTimeExpr) Day() expr.Expr

Day extracts the day component

func (*DateTimeExpr) DayOfWeek

func (dte *DateTimeExpr) DayOfWeek() expr.Expr

DayOfWeek extracts the day of week

func (*DateTimeExpr) DayOfYear

func (dte *DateTimeExpr) DayOfYear() expr.Expr

DayOfYear extracts the day of year

func (*DateTimeExpr) Diff

func (dte *DateTimeExpr) Diff(other expr.Expr) expr.Expr

Diff calculates the difference with another datetime expression

func (*DateTimeExpr) Floor

func (dte *DateTimeExpr) Floor(unit TimeUnit) expr.Expr

Floor rounds down to the nearest unit

func (*DateTimeExpr) Format

func (dte *DateTimeExpr) Format(format string) expr.Expr

Format formats the datetime values

func (*DateTimeExpr) Hour

func (dte *DateTimeExpr) Hour() expr.Expr

Hour extracts the hour component

func (*DateTimeExpr) Minute

func (dte *DateTimeExpr) Minute() expr.Expr

Minute extracts the minute component

func (*DateTimeExpr) Month

func (dte *DateTimeExpr) Month() expr.Expr

Month extracts the month component

func (*DateTimeExpr) Nanosecond

func (dte *DateTimeExpr) Nanosecond() expr.Expr

Nanosecond extracts the nanosecond component

func (*DateTimeExpr) Quarter

func (dte *DateTimeExpr) Quarter() expr.Expr

Quarter extracts the quarter

func (*DateTimeExpr) Resample

func (dte *DateTimeExpr) Resample(frequency string) *ResampleExpr

Resample creates a resample expression

func (*DateTimeExpr) Round

func (dte *DateTimeExpr) Round(unit TimeUnit) expr.Expr

Round rounds to the nearest unit

func (*DateTimeExpr) Second

func (dte *DateTimeExpr) Second() expr.Expr

Second extracts the second component

func (*DateTimeExpr) Sub

func (dte *DateTimeExpr) Sub(duration Duration) expr.Expr

Sub subtracts a duration from the datetime expression

func (*DateTimeExpr) ToLocal

func (dte *DateTimeExpr) ToLocal() expr.Expr

ToLocal creates an expression to convert datetime to local timezone

func (*DateTimeExpr) ToUTC

func (dte *DateTimeExpr) ToUTC() expr.Expr

ToUTC creates an expression to convert datetime to UTC

func (*DateTimeExpr) Truncate

func (dte *DateTimeExpr) Truncate(unit TimeUnit) expr.Expr

Truncate is an alias for Floor

func (*DateTimeExpr) WeekOfYear

func (dte *DateTimeExpr) WeekOfYear() expr.Expr

WeekOfYear extracts the week of year

func (*DateTimeExpr) Year

func (dte *DateTimeExpr) Year() expr.Expr

Year extracts the year component

type DateTimeFormatExpr

type DateTimeFormatExpr struct {
	// contains filtered or unexported fields
}

DateTimeFormatExpr represents datetime formatting

func (*DateTimeFormatExpr) Alias

func (e *DateTimeFormatExpr) Alias(name string) expr.Expr

func (*DateTimeFormatExpr) DataType

func (e *DateTimeFormatExpr) DataType() datatypes.DataType

func (*DateTimeFormatExpr) IsColumn

func (e *DateTimeFormatExpr) IsColumn() bool

func (*DateTimeFormatExpr) Name

func (e *DateTimeFormatExpr) Name() string

func (*DateTimeFormatExpr) String

func (e *DateTimeFormatExpr) String() string

type DateTimeRoundExpr

type DateTimeRoundExpr struct {
	// contains filtered or unexported fields
}

DateTimeRoundExpr represents datetime rounding operations

func (*DateTimeRoundExpr) Alias

func (e *DateTimeRoundExpr) Alias(name string) expr.Expr

func (*DateTimeRoundExpr) DataType

func (e *DateTimeRoundExpr) DataType() datatypes.DataType

func (*DateTimeRoundExpr) IsColumn

func (e *DateTimeRoundExpr) IsColumn() bool

func (*DateTimeRoundExpr) Name

func (e *DateTimeRoundExpr) Name() string

func (*DateTimeRoundExpr) String

func (e *DateTimeRoundExpr) String() string

type DateTimeSeries

type DateTimeSeries struct {
	// contains filtered or unexported fields
}

DateTimeSeries wraps a Series with DateTime operations

func DtSeries

func DtSeries(s series.Series) (*DateTimeSeries, error)

DtSeries returns DateTime operations for a Series

func (*DateTimeSeries) Add

func (dts *DateTimeSeries) Add(duration Duration) series.Series

Add adds a duration to each datetime value

func (*DateTimeSeries) AddBusinessDays

func (dts *DateTimeSeries) AddBusinessDays(days int) series.Series

AddBusinessDays adds business days to datetime/date series

func (*DateTimeSeries) ConvertTimezone

func (dts *DateTimeSeries) ConvertTimezone(tzName string) (series.Series, error)

ConvertTimezone converts all datetime values in the series to a new timezone

func (*DateTimeSeries) Day

func (dts *DateTimeSeries) Day() series.Series

Day extracts the day component

func (*DateTimeSeries) DayOfWeek

func (dts *DateTimeSeries) DayOfWeek() series.Series

DayOfWeek extracts the day of week (0=Sunday, 6=Saturday)

func (*DateTimeSeries) DayOfYear

func (dts *DateTimeSeries) DayOfYear() series.Series

DayOfYear extracts the day of year

func (*DateTimeSeries) Diff

func (dts *DateTimeSeries) Diff(other series.Series) (series.Series, error)

Diff calculates the difference between two datetime series

func (*DateTimeSeries) Floor

func (dts *DateTimeSeries) Floor(unit TimeUnit) series.Series

Floor rounds down to the specified time unit

func (*DateTimeSeries) Format

func (dts *DateTimeSeries) Format(layout string) series.Series

Format formats the DateTime values according to the given layout

func (*DateTimeSeries) GetTimezone

func (dts *DateTimeSeries) GetTimezone() string

GetTimezone returns the timezone of the datetime series

func (*DateTimeSeries) Hour

func (dts *DateTimeSeries) Hour() series.Series

Hour extracts the hour component

func (*DateTimeSeries) IsLeapYear

func (dts *DateTimeSeries) IsLeapYear() series.Series

IsLeapYear returns a boolean series indicating leap years

func (*DateTimeSeries) IsWeekend

func (dts *DateTimeSeries) IsWeekend() series.Series

IsWeekend returns a boolean series indicating whether each datetime is a weekend

func (*DateTimeSeries) Localize

func (dts *DateTimeSeries) Localize(tzName string) (series.Series, error)

Localize interprets naive timestamps as being in the specified timezone

func (*DateTimeSeries) Minute

func (dts *DateTimeSeries) Minute() series.Series

Minute extracts the minute component

func (*DateTimeSeries) Month

func (dts *DateTimeSeries) Month() series.Series

Month extracts the month component

func (*DateTimeSeries) Quarter

func (dts *DateTimeSeries) Quarter() series.Series

Quarter extracts the quarter (1-4)

func (*DateTimeSeries) Resample

func (dts *DateTimeSeries) Resample(rule *ResampleRule) (*ResampleGrouper, error)

Resample groups datetime series by time frequency

func (*DateTimeSeries) Second

func (dts *DateTimeSeries) Second() series.Series

Second extracts the second component

func (*DateTimeSeries) Sub

func (dts *DateTimeSeries) Sub(duration Duration) series.Series

Sub subtracts a duration from each datetime value

func (*DateTimeSeries) ToLocal

func (dts *DateTimeSeries) ToLocal() series.Series

ToLocal converts all datetime values to local timezone

func (*DateTimeSeries) ToUTC

func (dts *DateTimeSeries) ToUTC() series.Series

ToUTC converts all datetime values to UTC

func (*DateTimeSeries) Year

func (dts *DateTimeSeries) Year() series.Series

Year extracts the year component

type DateTimeSubExpr

type DateTimeSubExpr struct {
	// contains filtered or unexported fields
}

DateTimeSubExpr represents subtracting a duration from a datetime expression

func (*DateTimeSubExpr) Alias

func (e *DateTimeSubExpr) Alias(name string) expr.Expr

func (*DateTimeSubExpr) DataType

func (e *DateTimeSubExpr) DataType() datatypes.DataType

func (*DateTimeSubExpr) IsColumn

func (e *DateTimeSubExpr) IsColumn() bool

func (*DateTimeSubExpr) Name

func (e *DateTimeSubExpr) Name() string

func (*DateTimeSubExpr) String

func (e *DateTimeSubExpr) String() string

type Duration

type Duration struct {
	// contains filtered or unexported fields
}

Duration represents a time duration with support for calendar units

func Days

func Days(n int) Duration

Days creates a duration of n days

func Hours

func Hours(n int) Duration

Hours creates a duration of n hours

func Microseconds

func Microseconds(n int) Duration

Microseconds creates a duration of n microseconds

func Milliseconds

func Milliseconds(n int) Duration

Milliseconds creates a duration of n milliseconds

func Minutes

func Minutes(n int) Duration

Minutes creates a duration of n minutes

func Months

func Months(n int) Duration

Months creates a duration of n months

func Nanoseconds

func Nanoseconds(n int64) Duration

Nanoseconds creates a duration of n nanoseconds

func NewDuration

func NewDuration(months, days int32, nanoseconds int64) Duration

NewDuration creates a new duration

func ParseDuration

func ParseDuration(s string) (Duration, error)

func Seconds

func Seconds(n int) Duration

Seconds creates a duration of n seconds

func Weeks

func Weeks(n int) Duration

Weeks creates a duration of n weeks

func Years

func Years(n int) Duration

Years creates a duration of n years

func (Duration) Add

func (d Duration) Add(other Duration) Duration

Add adds two durations

func (Duration) IsZero

func (d Duration) IsZero() bool

IsZero returns true if the duration is zero

func (Duration) Negate

func (d Duration) Negate() Duration

Negate returns the negative of the duration

func (Duration) String

func (d Duration) String() string

type ResampleExpr

type ResampleExpr struct {
	// contains filtered or unexported fields
}

ResampleExpr represents a resample operation in the expression API

func (*ResampleExpr) Alias

func (e *ResampleExpr) Alias(name string) expr.Expr

func (*ResampleExpr) DataType

func (e *ResampleExpr) DataType() datatypes.DataType

func (*ResampleExpr) IsColumn

func (e *ResampleExpr) IsColumn() bool

func (*ResampleExpr) Name

func (e *ResampleExpr) Name() string

func (*ResampleExpr) String

func (e *ResampleExpr) String() string

type ResampleGrouper

type ResampleGrouper struct {
	// contains filtered or unexported fields
}

ResampleGrouper handles resampled groups

func (*ResampleGrouper) Aggregate

func (rg *ResampleGrouper) Aggregate(agg string, targetSeries series.Series) (series.Series, error)

Aggregate applies an aggregation function to resampled groups

func (*ResampleGrouper) Count

func (rg *ResampleGrouper) Count() (series.Series, error)

Count returns count of values in each bin

func (*ResampleGrouper) Mean

func (rg *ResampleGrouper) Mean(targetSeries series.Series) (series.Series, error)

Mean aggregates by mean

func (*ResampleGrouper) Sum

func (rg *ResampleGrouper) Sum(targetSeries series.Series) (series.Series, error)

Sum aggregates by sum

type ResampleRule

type ResampleRule struct {
	Frequency string     // Frequency string like "1D", "1H", "5min"
	Closed    string     // "left" or "right" - which side of bin is closed
	Label     string     // "left" or "right" - which edge to use for result label
	Origin    *time.Time // Origin time for grouping
}

ResampleRule defines how to resample time series data

func NewResampleRule

func NewResampleRule(frequency string) *ResampleRule

NewResampleRule creates a new resample rule with defaults

type StrToDateExpr

type StrToDateExpr struct {
	// contains filtered or unexported fields
}

StrToDateExpr converts string to date

func (*StrToDateExpr) Alias

func (e *StrToDateExpr) Alias(name string) expr.Expr

func (*StrToDateExpr) DataType

func (e *StrToDateExpr) DataType() datatypes.DataType

func (*StrToDateExpr) IsColumn

func (e *StrToDateExpr) IsColumn() bool

func (*StrToDateExpr) Name

func (e *StrToDateExpr) Name() string

func (*StrToDateExpr) String

func (e *StrToDateExpr) String() string

type StrToDateTimeExpr

type StrToDateTimeExpr struct {
	// contains filtered or unexported fields
}

StrToDateTimeExpr converts string to datetime

func (*StrToDateTimeExpr) Alias

func (e *StrToDateTimeExpr) Alias(name string) expr.Expr

func (*StrToDateTimeExpr) DataType

func (e *StrToDateTimeExpr) DataType() datatypes.DataType

func (*StrToDateTimeExpr) IsColumn

func (e *StrToDateTimeExpr) IsColumn() bool

func (*StrToDateTimeExpr) Name

func (e *StrToDateTimeExpr) Name() string

func (*StrToDateTimeExpr) String

func (e *StrToDateTimeExpr) String() string

type StrToTimeExpr

type StrToTimeExpr struct {
	// contains filtered or unexported fields
}

StrToTimeExpr converts string to time

func (*StrToTimeExpr) Alias

func (e *StrToTimeExpr) Alias(name string) expr.Expr

func (*StrToTimeExpr) DataType

func (e *StrToTimeExpr) DataType() datatypes.DataType

func (*StrToTimeExpr) IsColumn

func (e *StrToTimeExpr) IsColumn() bool

func (*StrToTimeExpr) Name

func (e *StrToTimeExpr) Name() string

func (*StrToTimeExpr) String

func (e *StrToTimeExpr) String() string

type Time

type Time struct {
	// contains filtered or unexported fields
}

Time represents time of day without date

func NewTime

func NewTime(hour, minute, second, nanosecond int) Time

NewTime creates a new Time

func ParseTime

func ParseTime(value string) (Time, error)

func ParseTimeWithFormat

func ParseTimeWithFormat(value string, format string) (Time, error)

func (Time) Format

func (t Time) Format(layout string) string

func (Time) Hour

func (t Time) Hour() int

Hour returns the hour component

func (Time) ISOFormat

func (t Time) ISOFormat() string

func (Time) Minute

func (t Time) Minute() int

Minute returns the minute component

func (Time) Nanosecond

func (t Time) Nanosecond() int

Nanosecond returns the nanosecond component

func (Time) Second

func (t Time) Second() int

Second returns the second component

func (Time) String

func (t Time) String() string

type TimeUnit

type TimeUnit int

TimeUnit represents the precision of temporal data

const (
	Nanosecond TimeUnit = iota
	Microsecond
	Millisecond
	Second
	Minute
	Hour
	Day
	Week
	Month
	Quarter
	Year
)

func (TimeUnit) String

func (tu TimeUnit) String() string

String returns the string representation of TimeUnit

func (TimeUnit) ToArrowTimeUnit

func (tu TimeUnit) ToArrowTimeUnit() arrow.TimeUnit

ToArrowTimeUnit converts TimeUnit to Arrow's TimeUnit

func (TimeUnit) ToDuration

func (tu TimeUnit) ToDuration() time.Duration

type TimezoneConvertExpr

type TimezoneConvertExpr struct {
	// contains filtered or unexported fields
}

TimezoneConvertExpr converts datetime to a new timezone

func (*TimezoneConvertExpr) Alias

func (e *TimezoneConvertExpr) Alias(name string) expr.Expr

func (*TimezoneConvertExpr) DataType

func (e *TimezoneConvertExpr) DataType() datatypes.DataType

func (*TimezoneConvertExpr) IsColumn

func (e *TimezoneConvertExpr) IsColumn() bool

func (*TimezoneConvertExpr) Name

func (e *TimezoneConvertExpr) Name() string

func (*TimezoneConvertExpr) String

func (e *TimezoneConvertExpr) String() string

Jump to

Keyboard shortcuts

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