package coredatetime
import "github.com/purpleidea/mgmt/lang/core/datetime"
Index ¶
- Constants
- func Format(ctx context.Context, input []types.Value) (types.Value, error)
- func Hour(ctx context.Context, input []types.Value) (types.Value, error)
- func Print(ctx context.Context, input []types.Value) (types.Value, error)
- func Weekday(ctx context.Context, input []types.Value) (types.Value, error)
- type DateTimeFact
Constants ¶
const ( // ModuleName is the prefix given to all the functions in this module. ModuleName = "datetime" )
const ( // NowFuncName is the name this fact is registered as. It's still a Func // Name because this is the name space the fact is actually using. NowFuncName = "now" )
Functions ¶
func Format ¶
Format returns returns a textual representation of the input time. The format has to be defined like specified by the golang "time" package. The time is the number of seconds since the epoch, and matches what comes from our Now function. Golang documentation: https://golang.org/pkg/time/#Time.Format
func Hour ¶
Hour returns the hour of the day corresponding to the input time. The time is the number of seconds since the epoch, and matches what comes from our Now function.
func Print ¶
Print takes an epoch int and returns a string in unix format.
func Weekday ¶
Weekday returns the lowercased day of the week corresponding to the input time. The time is the number of seconds since the epoch, and matches what comes from our Now function.
Types ¶
type DateTimeFact ¶
type DateTimeFact struct {
// contains filtered or unexported fields
}
DateTimeFact is a fact which returns the current date and time.
func (*DateTimeFact) Call ¶
Call this fact and return the value if it is possible to do so at this time.
func (*DateTimeFact) Info ¶
func (obj *DateTimeFact) Info() *facts.Info
Info returns some static info about itself.
func (*DateTimeFact) Init ¶
func (obj *DateTimeFact) Init(init *facts.Init) error
Init runs some startup code for this fact.
func (*DateTimeFact) Stream ¶
func (obj *DateTimeFact) Stream(ctx context.Context) error
Stream returns the changing values that this fact has over time.
func (*DateTimeFact) String ¶
func (obj *DateTimeFact) String() string
String returns a simple name for this fact. This is needed so this struct can satisfy the pgraph.Vertex interface.
Source Files ¶
datetime.go format.go hour.go now_fact.go print.go weekday.go
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 4 days ago –
Tools for package owners.