multitype

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolOrString

type BoolOrString struct {
	Type    BoolOrStringType `protobuf:"varbool,1,opt,name=type,casttype=Type"`
	BoolVal bool             `protobuf:"varbool,2,opt,name=boolVal"`
	StrVal  string           `protobuf:"bytes,3,opt,name=strVal"`
}

BoolOrString is a type that can hold an bool 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 booolean string or raw bool.

+protobuf=true +protobuf.options.(gogoproto.goproto_stringer)=false +k8s:openapi-gen=true

func FromBool

func FromBool(val bool) BoolOrString

FromBool creates an BoolOrString object with a bool value.

func FromString

func FromString(val string) BoolOrString

FromString creates an BoolOrString object with a string value.

func Parse added in v1.9.0

func Parse(val string) BoolOrString

Parse the given string

func (*BoolOrString) Fuzz

func (boolstr *BoolOrString) Fuzz(c fuzz.Continue)

func (BoolOrString) MarshalJSON

func (boolstr BoolOrString) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface.

func (BoolOrString) OpenAPISchemaFormat

func (BoolOrString) OpenAPISchemaFormat() string

OpenAPISchemaFormat is used by the kube-openapi generator when constructing the OpenAPI spec of this type.

func (BoolOrString) OpenAPISchemaType

func (BoolOrString) OpenAPISchemaType() []string

OpenAPISchemaType is used by the kube-openapi generator when constructing the OpenAPI spec of this type.

See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators

func (*BoolOrString) String

func (boolstr *BoolOrString) String() string

String returns the string value, '1' for true, or ” for false.

func (*BoolOrString) UnmarshalJSON

func (boolstr *BoolOrString) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaller boolerface.

type BoolOrStringType

type BoolOrStringType int

Type represents the stored type of BoolOrString.

const (
	Bool   BoolOrStringType = iota // The BoolOrString holds an bool.
	String                         // The BoolOrString holds a string.
)

Jump to

Keyboard shortcuts

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