Documentation ¶
Index ¶
- type Duration
- type SingleOrMulti
- func (a SingleOrMulti[T]) Copy() SingleOrMulti[T]
- func (a SingleOrMulti[T]) IsMulti() bool
- func (a SingleOrMulti[T]) MarshalJSON() ([]byte, error)
- func (a SingleOrMulti[T]) MarshalYAML() (any, error)
- func (a SingleOrMulti[T]) Multi() []T
- func (a SingleOrMulti[T]) Random() T
- func (a SingleOrMulti[T]) Single() T
- func (a SingleOrMulti[T]) String() string
- func (a *SingleOrMulti[T]) UnmarshalJSON(bytes []byte) error
- func (a *SingleOrMulti[T]) UnmarshalYAML(value *yaml.Node) error
- type TextComponent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶ added in v0.31.2
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 (*Duration) MarshalYAML ¶ added in v0.31.3
func (*Duration) UnmarshalJSON ¶ added in v0.31.2
func (*Duration) UnmarshalYAML ¶ added in v0.31.3
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
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