Documentation
¶
Overview ¶
Package value provides support for some additional flag value types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTimeLayouts = []string{ time.DateOnly, time.RFC3339, "2006-01-02T15:04:05", "2006-01-02 15:04:05", "2006-01-02T15:04", "2006-01-02 15:04", }
DefaultTimeLayouts specifies the layouts that are allowed when parsing Time. The default specifies RFC3339, which is what the built-in parser would use, plus bare dates (YYYY-MM-dd) and their time of day using the 24-hour clock and optionally with seconds resolution.
Functions ¶
Types ¶
type ByteLength ¶
type ByteLength int
ByteLength represents number of bytes
func (*ByteLength) UnmarshalText ¶
func (b *ByteLength) UnmarshalText(data []byte) error
type Hex ¶
type Hex int
Hex represents an integer that parses from the hex syntax
func (*Hex) UnmarshalText ¶
type Octal ¶
type Octal int
Octal represents an integer that parses from the octal syntax
func (*Octal) UnmarshalText ¶
type Time ¶ added in v0.21.1
type Time struct {
// AllowedLayouts specifies the layouts that are allowed when parsing
// the timestamps. By default, DefaultTimeLayouts is used when this
// is unspecified.
AllowedLayouts []string
// contains filtered or unexported fields
}
Time provides a value whose parsing can be configured, which increases the ergonomics of dates and times in flags and args.
func (Time) DateOnly ¶ added in v0.21.1
DateOnly indicates whether the timestamp was parsed only from a date, which means that the time of day that was intended by the user could be ambiguous.
func (*Time) Range ¶ added in v0.21.1
Range interprets the timestamp as a range of time. If an exact timestamp was specified or if any component of the time of day was specified, both return values will correspond to the value that was parsed. If only a date was specified the range will correspond to the start and end of day.