1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-16 11:37:36 +02:00
ferret/pkg/stdlib/datetime/lib.go
2020-03-10 21:18:04 -04:00

29 lines
873 B
Go

package datetime
import "github.com/MontFerret/ferret/pkg/runtime/core"
func RegisterLib(ns core.Namespace) error {
return ns.RegisterFunctions(
core.NewFunctionsFromMap(map[string]core.Function{
"NOW": Now,
"DATE": Date,
"DATE_DAYOFWEEK": DateDayOfWeek,
"DATE_YEAR": DateYear,
"DATE_MONTH": DateMonth,
"DATE_DAY": DateDay,
"DATE_HOUR": DateHour,
"DATE_MINUTE": DateMinute,
"DATE_SECOND": DateSecond,
"DATE_MILLISECOND": DateMillisecond,
"DATE_DAYOFYEAR": DateDayOfYear,
"DATE_LEAPYEAR": DateLeapYear,
"DATE_QUARTER": DateQuarter,
"DATE_DAYS_IN_MONTH": DateDaysInMonth,
"DATE_FORMAT": DateFormat,
"DATE_ADD": DateAdd,
"DATE_SUBTRACT": DateSubtract,
"DATE_DIFF": DateDiff,
}),
)
}