config

package
v0.0.0-...-47b5856 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeTOML

func DecodeTOML(r io.Reader, v any) error

DecodeTOML decodes toml from r in to v. Requires strict field matches and returns full toml.StrictMissingError details.

Types

type Duration

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

Duration is a non-negative time duration.

func MustNewDuration

func MustNewDuration(d time.Duration) *Duration

func NewDuration

func NewDuration(d time.Duration) (Duration, error)

func ParseDuration

func ParseDuration(s string) (Duration, error)

func (Duration) Before

func (d Duration) Before(t time.Time) time.Time

Before returns the time d units before time t

func (Duration) Duration

func (d Duration) Duration() time.Duration

func (Duration) IsInstant

func (d Duration) IsInstant() bool

IsInstant is true if and only if d is of duration 0

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

MarshalText implements the text.Marshaler interface.

func (*Duration) Scan

func (d *Duration) Scan(v interface{}) (err error)

func (Duration) Shorter

func (d Duration) Shorter(od Duration) bool

Shorter returns true if and only if d is shorter than od.

func (Duration) String

func (d Duration) String() 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

func (d *Duration) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(input []byte) error

UnmarshalText implements the text.Unmarshaler interface.

func (Duration) Value

func (d Duration) Value() (driver.Value, error)

type ErrEmpty

type ErrEmpty struct {
	Name string
	Msg  string
}

func (ErrEmpty) Error

func (e ErrEmpty) Error() string

type ErrInvalid

type ErrInvalid struct {
	Name  string
	Value any
	Msg   string
}

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

type ErrMissing struct {
	Name string
	Msg  string
}

func (ErrMissing) Error

func (e ErrMissing) Error() string

type KeyNotFoundError

type KeyNotFoundError struct {
	ID      string
	KeyType string
}

func (KeyNotFoundError) Error

func (e KeyNotFoundError) Error() string

type URL

type URL url.URL

URL extends url.URL to implement encoding.TextMarshaler.

func MustParseURL

func MustParseURL(s string) *URL

func ParseURL

func ParseURL(s string) (*URL, error)

func (*URL) IsZero

func (u *URL) IsZero() bool

func (*URL) MarshalText

func (u *URL) MarshalText() ([]byte, error)

func (*URL) String

func (u *URL) String() string

func (*URL) URL

func (u *URL) URL() *url.URL

URL returns a copy of u as a *url.URL

func (*URL) UnmarshalText

func (u *URL) UnmarshalText(input []byte) error

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.

func (UniqueStrings) IsDupeFmt

func (u UniqueStrings) IsDupeFmt(t fmt.Stringer) bool

IsDupeFmt is like IsDupe, but calls String().

Jump to

Keyboard shortcuts

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