types

package
v8.7.8-mod Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const JsonNull = "null"

Variables

This section is empty.

Functions

This section is empty.

Types

type FilteredInterface

type FilteredInterface struct {
	IsSet bool
	Value interface{}
}

func (FilteredInterface) MarshalJSON

func (n FilteredInterface) MarshalJSON() ([]byte, error)

func (*FilteredInterface) UnmarshalJSON

func (n *FilteredInterface) UnmarshalJSON(rawJSON []byte) error

type FilteredString

type FilteredString struct {
	IsSet bool
	Value string
}

FilteredString is a wrapper around string values that can be null/default or an actual value. Use IsSet to check if the value is provided, instead of checking against the empty string.

func NewFilteredString

func NewFilteredString(val string) *FilteredString

func (FilteredString) IsDefault

func (n FilteredString) IsDefault() bool

func (FilteredString) MarshalJSON

func (n FilteredString) MarshalJSON() ([]byte, error)

MarshalJSON marshals the value field if it's not empty, otherwise returns an null.

func (*FilteredString) ParseValue

func (n *FilteredString) ParseValue(val string)

ParseValue is used to parse a user provided flag argument.

func (FilteredString) String

func (n FilteredString) String() string

func (*FilteredString) UnmarshalJSON

func (n *FilteredString) UnmarshalJSON(rawJSON []byte) error

type FilteredStrings

type FilteredStrings []FilteredString

func (FilteredStrings) String

func (n FilteredStrings) String() string

type JSONObject

type JSONObject map[string]interface{}

JSONObject represents a JSON object. When not initialized it serializes to `{}`, whereas a `map[string]interface{}` serializes to `null`.

func (JSONObject) MarshalJSON

func (j JSONObject) MarshalJSON() ([]byte, error)

type NullBool

type NullBool struct {
	IsSet bool
	Value bool
}

NullBool is a wrapper around bool values that can be null or an bool. Use IsSet to check if the value is provided, instead of checking against false.

func (NullBool) MarshalJSON

func (n NullBool) MarshalJSON() ([]byte, error)

func (*NullBool) ParseBoolValue

func (n *NullBool) ParseBoolValue(val *bool)

ParseBoolValue is used to parse a user provided *bool argument.

func (*NullBool) ParseStringValue

func (n *NullBool) ParseStringValue(val string) error

ParseStringValue is used to parse a user provided flag argument.

func (*NullBool) UnmarshalJSON

func (n *NullBool) UnmarshalJSON(rawJSON []byte) error

type NullByteSizeInMb

type NullByteSizeInMb struct {
	IsSet bool

	// Value is a size in MB
	Value uint64
}

NullByteSizeInMb represents size in a byte format in megabytes.

func (*NullByteSizeInMb) ParseStringValue

func (b *NullByteSizeInMb) ParseStringValue(value string) error

func (*NullByteSizeInMb) ParseUint64Value

func (b *NullByteSizeInMb) ParseUint64Value(val *uint64)

ParseUint64Value is used to parse a user provided *uint64 argument.

func (NullByteSizeInMb) String

func (b NullByteSizeInMb) String() string

func (*NullByteSizeInMb) UnmarshalJSON

func (b *NullByteSizeInMb) UnmarshalJSON(rawJSON []byte) error

type NullInt

type NullInt struct {
	IsSet bool
	Value int
}

NullInt is a wrapper around integer values that can be null or an integer. Use IsSet to check if the value is provided, instead of checking against 0.

func (*NullInt) IsValidValue

func (n *NullInt) IsValidValue(val string) error

IsValidValue returns an error if the input value is not an integer.

func (NullInt) MarshalJSON

func (n NullInt) MarshalJSON() ([]byte, error)

func (*NullInt) ParseIntValue

func (n *NullInt) ParseIntValue(val *int)

ParseIntValue is used to parse a user provided *int argument.

func (*NullInt) ParseStringValue

func (n *NullInt) ParseStringValue(val string) error

ParseStringValue is used to parse a user provided flag argument.

func (*NullInt) UnmarshalFlag

func (n *NullInt) UnmarshalFlag(val string) error

func (*NullInt) UnmarshalJSON

func (n *NullInt) UnmarshalJSON(rawJSON []byte) error

type NullString

type NullString struct {
	Value string
	IsSet bool
}

func NewNullString

func NewNullString(optionalValue ...string) NullString

func (NullString) MarshalJSON

func (n NullString) MarshalJSON() ([]byte, error)

func (*NullString) UnmarshalJSON

func (n *NullString) UnmarshalJSON(rawJSON []byte) error

type NullUint64

type NullUint64 struct {
	IsSet bool
	Value uint64
}

NullUint64 is a wrapper around uint64 values that can be null or an unint64. Use IsSet to check if the value is provided, instead of checking against 0.

func (*NullUint64) ParseStringValue

func (n *NullUint64) ParseStringValue(val string) error

ParseStringValue is used to parse a user provided flag argument.

func (*NullUint64) UnmarshalJSON

func (n *NullUint64) UnmarshalJSON(rawJSON []byte) error

type OptionalBoolean

type OptionalBoolean struct {
	IsSet bool
	Value bool
}

func NewOptionalBoolean

func NewOptionalBoolean(value bool) OptionalBoolean

func (OptionalBoolean) MarshalJSON

func (o OptionalBoolean) MarshalJSON() ([]byte, error)

func (OptionalBoolean) OmitJSONry

func (o OptionalBoolean) OmitJSONry() bool

func (*OptionalBoolean) UnmarshalJSON

func (o *OptionalBoolean) UnmarshalJSON(rawJSON []byte) error

type OptionalObject

type OptionalObject struct {
	IsSet bool
	Value map[string]interface{}
}

OptionalObject is for situations where we want to differentiate between an empty object, and the object not having been set. An example would be an optional command line option where we want to tell the difference between it being set to an empty object, and it not being specified at all.

func NewOptionalObject

func NewOptionalObject(v map[string]interface{}) OptionalObject

func (OptionalObject) MarshalJSON

func (o OptionalObject) MarshalJSON() ([]byte, error)

func (OptionalObject) OmitJSONry

func (o OptionalObject) OmitJSONry() bool

func (*OptionalObject) UnmarshalJSON

func (o *OptionalObject) UnmarshalJSON(rawJSON []byte) error

type OptionalString

type OptionalString struct {
	IsSet bool
	Value string
}

func NewOptionalString

func NewOptionalString(v string) OptionalString

func (OptionalString) MarshalJSON

func (o OptionalString) MarshalJSON() ([]byte, error)

func (OptionalString) OmitJSONry

func (o OptionalString) OmitJSONry() bool

func (OptionalString) String

func (o OptionalString) String() string

func (*OptionalString) UnmarshalJSON

func (o *OptionalString) UnmarshalJSON(rawJSON []byte) error

type OptionalStringSlice

type OptionalStringSlice struct {
	IsSet bool
	Value []string
}

func NewOptionalStringSlice

func NewOptionalStringSlice(s ...string) OptionalStringSlice

func (OptionalStringSlice) MarshalJSON

func (o OptionalStringSlice) MarshalJSON() ([]byte, error)

func (OptionalStringSlice) OmitJSONry

func (o OptionalStringSlice) OmitJSONry() bool

func (OptionalStringSlice) String

func (o OptionalStringSlice) String() string

func (*OptionalStringSlice) UnmarshalJSON

func (o *OptionalStringSlice) UnmarshalJSON(rawJSON []byte) error

Jump to

Keyboard shortcuts

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