kubernetesk8s.io/kubernetes/pkg/util/intstr Index | Files

package intstr

import "k8s.io/kubernetes/pkg/util/intstr"

Index

Types

type IntOrString

type IntOrString struct {
	Type   Type
	IntVal int
	StrVal string
}

IntOrString is a type that can hold an int or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.

func FromInt

func FromInt(val int) IntOrString

FromInt creates an IntOrString object with an int value.

func FromString

func FromString(val string) IntOrString

FromString creates an IntOrString object with a string value.

func (*IntOrString) Fuzz

func (intstr *IntOrString) Fuzz(c fuzz.Continue)

func (IntOrString) MarshalJSON

func (intstr IntOrString) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

func (*IntOrString) String

func (intstr *IntOrString) String() string

String returns the string value, or the Itoa of the int value.

func (*IntOrString) UnmarshalJSON

func (intstr *IntOrString) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaller interface.

type Type

type Type int

Type represents the stored type of IntOrString.

const (
	Int    Type = iota // The IntOrString holds an int.
	String             // The IntOrString holds a string.
)

Source Files

intstr.go

Version
v1.2.0-alpha.4
Published
Nov 25, 2015
Platform
js/wasm
Imports
4 packages
Last checked
17 minutes ago

Tools for package owners.