types

package
v7.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 6 Imported by: 367

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 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

Jump to

Keyboard shortcuts

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