intstr

package
v1.21.0-kw9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 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 IntOrString

type IntOrString struct {
	Type     Type   `json:"type" protobuf:"varint,1,opt,name=type,casttype=Type"`
	Int64Val int64  `json:"int64Val,omitempty" protobuf:"varint,2,opt,name=int64Val"`
	StrVal   string `json:"strVal,omitempty" protobuf:"bytes,3,opt,name=strVal"`
}

func FromInt64

func FromInt64(val int64) IntOrString

FromInt64 creates an IntOrString object with an int64 value.

func FromString

func FromString(val string) IntOrString

FromString creates an IntOrString object with a string value.

func Parse

func Parse(val string) IntOrString

Parse the given string and try to convert it to an int64 before setting it as a string value.

func (*IntOrString) Int64Value

func (int64str *IntOrString) Int64Value() int64

Int64Value returns the Int64Val if type Int64, or if it is a String, will attempt a conversion to int64, returning 0 if a parsing error occurs.

func (IntOrString) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface.

func (IntOrString) OpenAPISchemaFormat

func (IntOrString) OpenAPISchemaFormat() string

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

func (IntOrString) OpenAPISchemaType

func (IntOrString) 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 (*IntOrString) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface.

type Type

type Type int64

Type represents the stored type of IntOrString.

const (
	Int64  Type = iota // The IntOrString holds an int64.
	String             // The IntOrString holds a string.
)

Jump to

Keyboard shortcuts

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