configutil

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration added in v0.31.2

type Duration time.Duration

Duration is a configuration duration. It is a wrapper around time.Duration that implements the json.Marshaler and json.Unmarshaler interfaces.

  • string is parsed using time.ParseDuration.
  • int64 and float64 are interpreted as seconds.

func (*Duration) MarshalJSON added in v0.31.2

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

func (*Duration) MarshalYAML added in v0.31.3

func (d *Duration) MarshalYAML() (any, error)

func (*Duration) UnmarshalJSON added in v0.31.2

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

func (*Duration) UnmarshalYAML added in v0.31.3

func (d *Duration) UnmarshalYAML(value *yaml.Node) error

type SingleOrMulti added in v0.24.0

type SingleOrMulti[T any] []T

SingleOrMulti is a type that can be either a single value or a slice of values.

func (SingleOrMulti[T]) Copy added in v0.31.0

func (a SingleOrMulti[T]) Copy() SingleOrMulti[T]

Copy returns a copy of the SingleOrMulti.

func (SingleOrMulti[T]) IsMulti added in v0.24.0

func (a SingleOrMulti[T]) IsMulti() bool

IsMulti returns true if the value is a slice of values.

func (SingleOrMulti[T]) MarshalJSON added in v0.24.0

func (a SingleOrMulti[T]) MarshalJSON() ([]byte, error)

MarshalJSON marshals the value as a JSON array if it is a slice of values. Otherwise, it marshals the single value.

func (SingleOrMulti[T]) MarshalYAML added in v0.24.0

func (a SingleOrMulti[T]) MarshalYAML() (any, error)

MarshalYAML marshals the value as a YAML array if it is a slice of values. Otherwise, it marshals the single value.

func (SingleOrMulti[T]) Multi added in v0.24.0

func (a SingleOrMulti[T]) Multi() []T

Multi returns the slice of values.

func (SingleOrMulti[T]) Random added in v0.24.0

func (a SingleOrMulti[T]) Random() T

Random returns a random value from the slice or zero value if the slice is empty.

func (SingleOrMulti[T]) Single added in v0.24.0

func (a SingleOrMulti[T]) Single() T

Single returns first value in the slice or zero value if the slice is empty.

func (SingleOrMulti[T]) String added in v0.24.0

func (a SingleOrMulti[T]) String() string

String returns the string representation of the SingleOrMulti.

func (*SingleOrMulti[T]) UnmarshalJSON added in v0.24.0

func (a *SingleOrMulti[T]) UnmarshalJSON(bytes []byte) error

UnmarshalJSON unmarshals the value as a JSON array if it is a slice of values. Otherwise, it unmarshals the single value.

func (*SingleOrMulti[T]) UnmarshalYAML added in v0.24.0

func (a *SingleOrMulti[T]) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML unmarshals the value as a YAML array if it is a slice of values. Otherwise, it unmarshals the single value.

type TextComponent added in v0.33.0

type TextComponent component.Text

TextComponent is a component.Text that implements the yaml and json interfaces.

func (*TextComponent) MarshalJSON added in v0.33.0

func (t *TextComponent) MarshalJSON() ([]byte, error)

func (*TextComponent) MarshalYAML added in v0.33.0

func (t *TextComponent) MarshalYAML() (any, error)

func (*TextComponent) T added in v0.33.0

func (t *TextComponent) T() *component.Text

T returns the underlying component.Text.

func (*TextComponent) UnmarshalJSON added in v0.33.0

func (t *TextComponent) UnmarshalJSON(data []byte) error

func (*TextComponent) UnmarshalYAML added in v0.33.0

func (t *TextComponent) UnmarshalYAML(value *yaml.Node) error

type URL added in v0.34.0

type URL url.URL

URL is a parsed URL.

func (*URL) MarshalBinary added in v0.34.0

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

MarshalBinary implements encoding.BinaryMarshaler.

func (*URL) MarshalJSON added in v0.34.0

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

func (*URL) MarshalYAML added in v0.34.0

func (u *URL) MarshalYAML() (any, error)

func (*URL) String added in v0.34.0

func (u *URL) String() string

String returns the string representation of the URL.

func (*URL) T added in v0.34.0

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

T returns the underlying url.URL.

func (*URL) UnmarshalBinary added in v0.34.0

func (u *URL) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (*URL) UnmarshalJSON added in v0.34.0

func (u *URL) UnmarshalJSON(data []byte) error

func (*URL) UnmarshalYAML added in v0.34.0

func (u *URL) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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