common

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetReflectNextElem added in v0.11.0

func GetReflectNextElem(v reflect.Value) reflect.Value

func ValidateDescription added in v0.52.0

func ValidateDescription(description string) error

ValidateDescription checks for forbidden items in substring used inside description

func ValidateID added in v0.12.0

func ValidateID(name string) error

ValidateID checks for forbidden items in substring used inside id

Types

type Display added in v0.11.0

type Display struct {
	Name        string `json:"name,omitempty" yaml:"name,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

type Duration added in v0.50.0

type Duration time.Duration

Duration wraps time.Duration. It is used to parse the custom duration format from YAML. This type should not propagate beyond the scope of input/output processing. +kubebuilder:validation:Type=string +kubebuilder:validation:Format=duration +kubebuilder:validation:Pattern=`^(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?$`

func ParseDuration added in v0.50.0

func ParseDuration(s string) (Duration, error)

ParseDuration parses a string into a time.Duration, assuming that a year always has 365d, a week always has 7d, and a day always has 24h.

func (Duration) MarshalJSON added in v0.50.0

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

MarshalJSON implements the json.Marshaler interface.

func (*Duration) MarshalText added in v0.50.0

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

MarshalText implements the encoding.TextMarshaler interface.

func (Duration) MarshalYAML added in v0.50.0

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

MarshalYAML implements the yaml.Marshaler interface.

func (*Duration) Set added in v0.50.0

func (d *Duration) Set(s string) error

Set implements pflag/flag.Value

func (Duration) String added in v0.50.0

func (d Duration) String() string

func (*Duration) Type added in v0.50.0

func (d *Duration) Type() string

Type implements pflag.Value

func (*Duration) UnmarshalJSON added in v0.50.0

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

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Duration) UnmarshalText added in v0.50.0

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*Duration) UnmarshalYAML added in v0.50.0

func (d *Duration) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type JSONRef

type JSONRef struct {
	// Ref is the JSON reference.
	// That's the only thing used during the marshalling / unmarshalling process.
	// Other attributes are ignored during these processes.
	Ref string `json:"$ref" yaml:"$ref"`
	// Path is a list of string that will be used to find from the root of the struct the object pointed.
	Path []string `json:"-" yaml:"-"`
	// Object will contain the pointer to the actual object referenced by Ref
	Object any `json:"-" yaml:"-"`
}

func (*JSONRef) UnmarshalJSON

func (j *JSONRef) UnmarshalJSON(data []byte) error

func (*JSONRef) UnmarshalYAML

func (j *JSONRef) UnmarshalYAML(unmarshal func(any) error) error

type Plugin added in v0.11.0

type Plugin struct {
	Kind string `json:"kind" yaml:"kind"`
	// +kubebuilder:pruning:PreserveUnknownFields
	// +kubebuilder:validation:Schemaless
	Spec any `json:"spec" yaml:"spec"`
}

func (Plugin) JSONMarshal added in v0.11.0

func (p Plugin) JSONMarshal() ([]byte, error)

func (*Plugin) UnmarshalJSON added in v0.11.0

func (p *Plugin) UnmarshalJSON(data []byte) error

func (*Plugin) UnmarshalYAML added in v0.11.0

func (p *Plugin) UnmarshalYAML(unmarshal func(any) error) error

type Regexp

type Regexp struct {
	*regexp.Regexp
	// contains filtered or unexported fields
}

Regexp encapsulates a regexp.Regexp and makes it JSON/YAML marshalable.

func MustNewRegexp

func MustNewRegexp(s string) Regexp

MustNewRegexp works like NewRegexp, but panics if the regular expression does not compile.

func NewRegexp

func NewRegexp(s string) (Regexp, error)

NewRegexp creates a new anchored Regexp and returns an error if the passed-in regular expression does not compile.

func (Regexp) MarshalJSON

func (re Regexp) MarshalJSON() ([]byte, error)

func (Regexp) MarshalYAML

func (re Regexp) MarshalYAML() (any, error)

func (*Regexp) UnmarshalJSON

func (re *Regexp) UnmarshalJSON(data []byte) error

func (*Regexp) UnmarshalYAML

func (re *Regexp) UnmarshalYAML(unmarshal func(any) error) error

type URL added in v0.43.0

type URL struct {
	*url.URL `json:"-" yaml:"-"`
}

+kubebuilder:validation:Schemaless +kubebuilder:validation:Type=string +kubebuilder:validation:Format=uri

func MustParseURL added in v0.45.0

func MustParseURL(rawURL string) *URL

func NewURL added in v0.50.1

func NewURL(u *URL, paths ...string) *URL

func ParseURL added in v0.43.0

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

func (*URL) IsNilOrEmpty added in v0.43.0

func (u *URL) IsNilOrEmpty() bool

func (URL) MarshalJSON added in v0.43.0

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

MarshalJSON implements the json.Marshaler interface for URL.

func (*URL) MarshalText added in v0.43.0

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

MarshalText implements the encoding.TextMarshaler interface.

func (URL) MarshalYAML added in v0.43.0

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

MarshalYAML implements the yaml.Marshaler interface for URLs.

func (*URL) String added in v0.51.0

func (u *URL) String() string

func (*URL) UnmarshalJSON added in v0.43.0

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

UnmarshalJSON implements the json.Marshaler interface for URL.

func (*URL) UnmarshalText added in v0.43.0

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (*URL) UnmarshalYAML added in v0.43.0

func (u *URL) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.

Jump to

Keyboard shortcuts

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