[New] Constructor for time types, that accepts time.Time. (TimeT, TimezT, DateT, ...)

This commit is contained in:
go-jet 2019-08-06 11:41:45 +02:00
parent 647ef21aaf
commit 6ee2f45548
11 changed files with 182 additions and 22 deletions

View file

@ -18,18 +18,38 @@ var Date = func(year int, month time.Month, day int) DateExpression {
return CAST(jet.Date(year, month, day)).AS_DATE()
}
var DateT = func(t time.Time) DateExpression {
return CAST(jet.DateT(t)).AS_DATE()
}
var Time = func(hour, minute, second int, milliseconds ...int) TimeExpression {
return CAST(jet.Time(hour, minute, second, milliseconds...)).AS_TIME()
}
var TimeT = func(t time.Time) TimeExpression {
return CAST(jet.TimeT(t)).AS_TIME()
}
var Timez = func(hour, minute, second, milliseconds int, timezone int) TimezExpression {
return CAST(jet.Timez(hour, minute, second, milliseconds, timezone)).AS_TIMEZ()
}
var TimezT = func(t time.Time) TimezExpression {
return CAST(jet.TimezT(t)).AS_TIMEZ()
}
var Timestamp = func(year int, month time.Month, day, hour, minute, second, milliseconds int) TimestampExpression {
return CAST(jet.Timestamp(year, month, day, hour, minute, second, milliseconds)).AS_TIMESTAMP()
}
var TimestampT = func(t time.Time) TimestampExpression {
return CAST(jet.TimestampzT(t)).AS_TIMESTAMP()
}
var Timestampz = func(year, month, day, hour, minute, second, milliseconds int, timezone int) TimestampzExpression {
return CAST(jet.Timestampz(year, month, day, hour, minute, second, milliseconds, timezone)).AS_TIMESTAMPZ()
}
var TimestampzT = func(t time.Time) TimestampzExpression {
return CAST(jet.TimestampzT(t)).AS_TIMESTAMPZ()
}