mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-05 00:49:00 +02:00
Added missed datetime library (#462)
This commit is contained in:
@ -2,8 +2,9 @@ package datetime
|
||||
|
||||
import "github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
|
||||
func NewLib() map[string]core.Function {
|
||||
return map[string]core.Function{
|
||||
func RegisterLib(ns core.Namespace) error {
|
||||
return ns.RegisterFunctions(
|
||||
core.NewFunctionsFromMap(map[string]core.Function{
|
||||
"NOW": Now,
|
||||
"DATE": Date,
|
||||
"DATE_DAYOFWEEK": DateDayOfWeek,
|
||||
@ -22,5 +23,6 @@ func NewLib() map[string]core.Function {
|
||||
"DATE_ADD": DateAdd,
|
||||
"DATE_SUBTRACT": DateSubtract,
|
||||
"DATE_DIFF": DateDiff,
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
"github.com/MontFerret/ferret/pkg/stdlib/arrays"
|
||||
"github.com/MontFerret/ferret/pkg/stdlib/collections"
|
||||
"github.com/MontFerret/ferret/pkg/stdlib/datetime"
|
||||
"github.com/MontFerret/ferret/pkg/stdlib/html"
|
||||
"github.com/MontFerret/ferret/pkg/stdlib/io"
|
||||
"github.com/MontFerret/ferret/pkg/stdlib/math"
|
||||
@ -30,6 +31,10 @@ func RegisterLib(ns core.Namespace) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := datetime.RegisterLib(ns); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := arrays.RegisterLib(ns); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user