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

29 lines
873 B
Go
Raw Normal View History

2018-10-30 21:59:18 +02:00
package datetime
import "github.com/MontFerret/ferret/pkg/runtime/core"
2020-03-11 03:18:04 +02:00
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,
}),
)
2018-10-30 21:59:18 +02:00
}