datetime

package
v0.0.0-...-e5fa29d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2021 License: Apache-2.0 Imports: 4 Imported by: 9

Documentation

Overview

Package datetime implements marshalling of Go DateTime values into Noms structs with type DateTimeType.

Index

Constants

This section is empty.

Variables

View Source
var DateTimeType = types.MakeStructTypeFromFields(datetypename, types.FieldMap{
	"secSinceEpoch": types.NumberType,
})

DateTimeType is the Noms type used to represent date time objects in Noms. The field secSinceEpoch may contain fractions in cases where seconds are not sufficient.

View Source
var Epoch = DateTime{time.Unix(0, 0)}

Epoch is the unix Epoch. This time is very consistent, which makes it useful for testing or checking for uninitialized values

Functions

func RegisterHRSCommenter

func RegisterHRSCommenter(tz *time.Location)

Types

type DateTime

type DateTime struct {
	time.Time
}

DateTime implements marshaling of time.Time to and from Noms.

func Now

func Now() DateTime

Now is an alias for a DateTime initialized with time.Now()

func (DateTime) MarshalNoms

func (dt DateTime) MarshalNoms(vrw types.ValueReadWriter) (types.Value, error)

MarshalNoms makes DateTime implement marshal.Marshaler and it makes DateTime marshal into a Noms struct with type DateTimeType.

func (DateTime) MarshalNomsType

func (dt DateTime) MarshalNomsType() (*types.Type, error)

MarshalNomsType makes DateTime implement marshal.TypeMarshaler and it allows marshal.MarshalType to work with DateTime.

func (*DateTime) UnmarshalNoms

func (dt *DateTime) UnmarshalNoms(v types.Value) error

UnmarshalNoms makes DateTime implement marshal.Unmarshaler and it allows Noms struct with type DateTimeType able to be unmarshaled onto a DateTime Go struct

type DateTimeCommenter

type DateTimeCommenter struct {
	// contains filtered or unexported fields
}

func (DateTimeCommenter) Comment

func (c DateTimeCommenter) Comment(v types.Value) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL