types

package
Version: v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package types provides a collection of Golang types with JSON marshaling support

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayOrInt

type ArrayOrInt []int
 GO => Json
 [] => `[]`
[1] => `1`

[1, 2] => `[1,2]`

func (*ArrayOrInt) MarshalJSON

func (m *ArrayOrInt) MarshalJSON() ([]byte, error)

func (*ArrayOrInt) UnmarshalJSON

func (m *ArrayOrInt) UnmarshalJSON(data []byte) error

type ArrayOrString

type ArrayOrString []string
   GO => Json
   [] => `[]`
["a"] => `"a"`

["a", "b"] => `["a","b"]`

func (*ArrayOrString) MarshalJSON

func (m *ArrayOrString) MarshalJSON() ([]byte, error)

func (*ArrayOrString) UnmarshalJSON

func (m *ArrayOrString) UnmarshalJSON(data []byte) error

type BoolYo

type BoolYo bool

func (*BoolYo) MarshalJSON

func (m *BoolYo) MarshalJSON() ([]byte, error)

func (*BoolYo) UnmarshalJSON

func (m *BoolYo) UnmarshalJSON(data []byte) error

type IntHash

type IntHash struct {
	// contains filtered or unexported fields
}

IntHash represents as int64 Generation and string Hash. It is json serialized into <int64>$<hash_string>.

+k8s:openapi-gen=true

func IntHashForGeneration

func IntHashForGeneration(i int64) *IntHash

func IntHashForHash

func IntHashForHash(h string) *IntHash

func NewIntHash

func NewIntHash(i int64, h string) *IntHash

func ParseIntHash

func ParseIntHash(v interface{}) (*IntHash, error)

func (*IntHash) DeepCopy

func (m *IntHash) DeepCopy() *IntHash

func (*IntHash) DeepCopyInto

func (m *IntHash) DeepCopyInto(out *IntHash)

func (*IntHash) Equal

func (m *IntHash) Equal(u *IntHash) bool

func (IntHash) Generation

func (m IntHash) Generation() int64

func (IntHash) Hash

func (m IntHash) Hash() string

func (*IntHash) IsZero

func (m *IntHash) IsZero() bool

IsZero returns true if the value is nil or time is zero.

func (*IntHash) MarshalJSON

func (m *IntHash) MarshalJSON() ([]byte, error)

func (IntHash) MarshalQueryParameter

func (m IntHash) MarshalQueryParameter() (string, error)

MarshalQueryParameter converts to a URL query parameter value

func (IntHash) OpenAPISchemaFormat

func (_ IntHash) OpenAPISchemaFormat() string

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

func (IntHash) OpenAPISchemaType

func (_ IntHash) 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 (IntHash) String

func (m IntHash) String() string

func (*IntHash) UnmarshalJSON

func (m *IntHash) UnmarshalJSON(data []byte) error

type StrToBool

type StrToBool bool

StrToBool turns strings into bool when marshaled to Json. Empty strings are converted to false. Non-empty string, eg, `"false"` will become True bool value. If already a json bool, then no change is made.

This can be used to turn a string to bool if you have existing Json data.

func (*StrToBool) MarshalJSON

func (m *StrToBool) MarshalJSON() ([]byte, error)

func (*StrToBool) UnmarshalJSON

func (m *StrToBool) UnmarshalJSON(data []byte) error

type StrYo

type StrYo string

StrYo turns non-strings into into a string by adding quotes around it into bool, when marshaled to Json. If input is already string, no change is done.

func (*StrYo) UnmarshalJSON

func (m *StrYo) UnmarshalJSON(data []byte) error

type URLMap

type URLMap struct {
	Scheme string
	Hosts  map[string]string
	Port   int
}

func NewURLMap

func NewURLMap(scheme string, port int) *URLMap

func (*URLMap) Delete

func (um *URLMap) Delete(hosts ...string)

func (URLMap) Equal

func (um URLMap) Equal(s2 URLMap) bool

func (*URLMap) Has

func (um *URLMap) Has(host string) bool

func (*URLMap) Insert

func (um *URLMap) Insert(name, host string)

func (*URLMap) MarshalJSON

func (um *URLMap) MarshalJSON() ([]byte, error)

func (*URLMap) UnmarshalJSON

func (um *URLMap) UnmarshalJSON(data []byte) error

type URLSet

type URLSet struct {
	Scheme string
	Hosts  sets.String
	Port   int
}

func NewURLSet

func NewURLSet(scheme string, port int) *URLSet

func (*URLSet) Delete

func (us *URLSet) Delete(hosts ...string)

func (URLSet) Equal

func (s1 URLSet) Equal(s2 URLSet) bool

func (*URLSet) Has

func (us *URLSet) Has(host string) bool

func (*URLSet) Insert

func (us *URLSet) Insert(hosts ...string)

func (*URLSet) MarshalJSON

func (us *URLSet) MarshalJSON() ([]byte, error)

func (*URLSet) UnmarshalJSON

func (us *URLSet) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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