configutil

package
v0.33.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 10 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

Jump to

Keyboard shortcuts

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