numstr

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NumberOrString

type NumberOrString struct {
	IsString bool
	NumVal   json.Number
	StrVal   string
}

NumberOrString is value that can a JSON number or string.

func FromFloat64

func FromFloat64(val float64) NumberOrString

FromFloat64 returns the supplied value as a NumberOrString

func FromInt64

func FromInt64(val int64) NumberOrString

FromInt64 returns the supplied value as a NumberOrString

func FromNumber

func FromNumber(val json.Number) NumberOrString

FromNumber returns the supplied value as a NumberOrString

func FromString

func FromString(val string) NumberOrString

FromString returns the supplied value as a NumberOrString

func (*NumberOrString) Float64Value

func (s *NumberOrString) Float64Value() float64

Float64Value coerces the value to a float64.

func (*NumberOrString) Int64Value

func (s *NumberOrString) Int64Value() int64

Int64Value coerces the value to an int64.

func (NumberOrString) MarshalJSON

func (s NumberOrString) MarshalJSON() ([]byte, error)

MarshalJSON writes the value with the appropriate type.

func (*NumberOrString) String

func (s *NumberOrString) String() string

String coerces the value to a string.

func (*NumberOrString) UnmarshalJSON

func (s *NumberOrString) UnmarshalJSON(b []byte) error

UnmarshalJSON reads the value from either a string or number.

Jump to

Keyboard shortcuts

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