value

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Type

type Type int

Type describes the type of the data Value holds.

const (
	INVALID Type = iota // No value.
	BOOL                // Boolean value, use AsBool() to get it.
	INT32               // 32 bit signed integral value, use AsInt32() to get it.
	INT64               // 64 bit signed integral value, use AsInt64() to get it.
	UINT32              // 32 bit unsigned integral value, use AsUint32() to get it.
	UINT64              // 64 bit unsigned integral value, use AsUint64() to get it.
	FLOAT32             // 32 bit floating point value, use AsFloat32() to get it.
	FLOAT64             // 64 bit floating point value, use AsFloat64() to get it.
	STRING              // String value, use AsString() to get it.
)

func (Type) String

func (i Type) String() string

type Value

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

Value represents the value part in key-value pairs.

func Bool

func Bool(v bool) Value

Bool creates a BOOL Value.

func Float32

func Float32(v float32) Value

Float32 creates a FLOAT32 Value.

func Float64

func Float64(v float64) Value

Float64 creates a FLOAT64 Value.

func Int

func Int(v int) Value

Int creates either an INT32 or an INT64 Value, depending on whether the int type is 32 or 64 bits wide.

func Int32

func Int32(v int32) Value

Int32 creates an INT32 Value.

func Int64

func Int64(v int64) Value

Int64 creates an INT64 Value.

func String

func String(v string) Value

String creates a STRING Value.

func Uint

func Uint(v uint) Value

Uint creates either a UINT32 or a UINT64 Value, depending on whether the uint type is 32 or 64 bits wide.

func Uint32

func Uint32(v uint32) Value

Uint32 creates a UINT32 Value.

func Uint64

func Uint64(v uint64) Value

Uint64 creates a UINT64 Value.

func (Value) AsBool

func (v Value) AsBool() bool

AsBool returns the bool value. Make sure that the Value's type is BOOL.

func (Value) AsFloat32

func (v Value) AsFloat32() float32

AsFloat32 returns the float32 value. Make sure that the Value's type is FLOAT32.

func (Value) AsFloat64

func (v Value) AsFloat64() float64

AsFloat64 returns the float64 value. Make sure that the Value's type is FLOAT64.

func (Value) AsInt32

func (v Value) AsInt32() int32

AsInt32 returns the int32 value. Make sure that the Value's type is INT32.

func (Value) AsInt64

func (v Value) AsInt64() int64

AsInt64 returns the int64 value. Make sure that the Value's type is INT64.

func (Value) AsInterface

func (v Value) AsInterface() interface{}

AsInterface returns Value's data as interface{}.

func (Value) AsString

func (v Value) AsString() string

AsString returns the string value. Make sure that the Value's type is STRING.

func (Value) AsUint32

func (v Value) AsUint32() uint32

AsUint32 returns the uint32 value. Make sure that the Value's type is UINT32.

func (Value) AsUint64

func (v Value) AsUint64() uint64

AsUint64 returns the uint64 value. Make sure that the Value's type is UINT64.

func (Value) Emit

func (v Value) Emit() string

Emit returns a string representation of Value's data.

func (Value) MarshalJSON

func (v Value) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of the Value.

func (Value) Type

func (v Value) Type() Type

Type returns a type of the Value.

Jump to

Keyboard shortcuts

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