Documentation ¶
Index ¶
- func DecodeTOML(r io.Reader, v any) error
- type Duration
- func (d Duration) Before(t time.Time) time.Time
- func (d Duration) Duration() time.Duration
- func (d Duration) IsInstant() bool
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d Duration) MarshalText() ([]byte, error)
- func (d *Duration) Scan(v interface{}) (err error)
- func (d Duration) Shorter(od Duration) bool
- func (d Duration) String() string
- func (d *Duration) UnmarshalJSON(input []byte) error
- func (d *Duration) UnmarshalText(input []byte) error
- func (d Duration) Value() (driver.Value, error)
- type ErrEmpty
- type ErrInvalid
- type ErrMissing
- type KeyNotFoundError
- type URL
- type UniqueStrings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
Duration is a non-negative time duration.
func MustNewDuration ¶
func ParseDuration ¶
func (Duration) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Duration) MarshalText ¶
MarshalText implements the text.Marshaler interface.
func (Duration) String ¶
String returns a string representing the duration in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Duration) UnmarshalText ¶
UnmarshalText implements the text.Unmarshaler interface.
type ErrInvalid ¶
func NewErrDuplicate ¶
func NewErrDuplicate(name string, value any) ErrInvalid
NewErrDuplicate returns an ErrInvalid with a standard duplicate message.
func (ErrInvalid) Error ¶
func (e ErrInvalid) Error() string
type ErrMissing ¶
func (ErrMissing) Error ¶
func (e ErrMissing) Error() string
type KeyNotFoundError ¶
func (KeyNotFoundError) Error ¶
func (e KeyNotFoundError) Error() string
type URL ¶
URL extends url.URL to implement encoding.TextMarshaler.
func MustParseURL ¶
func (*URL) MarshalText ¶
func (*URL) UnmarshalText ¶
type UniqueStrings ¶
type UniqueStrings map[string]struct{}
UniqueStrings is a helper for tracking unique values in string form.
func (UniqueStrings) IsDupe ¶
func (u UniqueStrings) IsDupe(s *string) bool
IsDupe returns true if the set already contains the string, otherwise false. Non-nil/empty strings are added to the set.