fastcast

package module
v0.0.0-...-6401d94 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUnion

func AppendUnion(storage interface{}, field interface{}) error

AppendUnion -

func AsBool

func AsBool(v interface{}) bool

AsBool - returns bool representation of passed value NOTE: variable can fit data up to its sizeof

func AsByte

func AsByte(v interface{}) byte

AsByte - returns byte representation of passed value NOTE: variable can fit data up to its sizeof

func AsByteSlice

func AsByteSlice(v interface{}) []byte

AsByteSlice - returns []byte representation of passed value do not leak result to heap if you want to stay safe

func AsFloat32

func AsFloat32(v interface{}) float32

AsFloat32 - returns float32 representation of passed value NOTE: variable can fit data up to its sizeof

func AsFloat64

func AsFloat64(v interface{}) float64

AsFloat64 - returns float64 representation of passed value NOTE: variable can fit data up to its sizeof

func AsInt

func AsInt(v interface{}) int

AsInt - returns int representation of passed value NOTE: variable can fit data up to its sizeof

func AsInt16

func AsInt16(v interface{}) int16

AsInt16 - returns int16 representation of passed value NOTE: variable can fit data up to its sizeof

func AsInt32

func AsInt32(v interface{}) int32

AsInt32 - returns int32 representation of passed value NOTE: variable can fit data up to its sizeof

func AsInt64

func AsInt64(v interface{}) int64

AsInt64 - returns int64 representation of passed value NOTE: variable can fit data up to its sizeof

func AsInt8

func AsInt8(v interface{}) int8

AsInt8 - returns int8 representation of passed value NOTE: variable can fit data up to its sizeof

func AsRune

func AsRune(v interface{}) rune

AsRune - returns rune representation of passed value NOTE: variable can fit data up to its sizeof

func AsString

func AsString(v interface{}) string

AsString - returns string representation of passed value do not leak result to heap if you want to stay safe

func AsUInt

func AsUInt(v interface{}) uint

AsUInt - returns uint representation of passed value NOTE: variable can fit data up to its sizeof

func AsUInt16

func AsUInt16(v interface{}) uint16

AsUInt16 - returns uint16 representation of passed value NOTE: variable can fit data up to its sizeof

func AsUInt32

func AsUInt32(v interface{}) uint32

AsUInt32 - returns uint32 representation of passed value NOTE: variable can fit data up to its sizeof

func AsUInt64

func AsUInt64(v interface{}) uint64

AsUInt64 - returns uint64 representation of passed value NOTE: variable can fit data up to its sizeof

func AsUInt8

func AsUInt8(v interface{}) uint8

AsUInt8 - returns uint8 representation of passed value NOTE: variable can fit data up to its sizeof

func AsUintPtr

func AsUintPtr(v interface{}) uintptr

AsUintPtr - returns uintptr representation of passed value NOTE: variable can fit data up to its sizeof

func BuildUnion

func BuildUnion(storage interface{}, fields ...interface{}) error

BuildUnion -

func ToByteSlice

func ToByteSlice(v interface{}) []byte

ToByteSlice - Accepts only slices, arrays, strings and pointers to primitives. Primitives converts to []byte with len up to its sizeof. Returns nil if fails

NOTE: it permanently transmutates original value if its element size is larger than destination one. Use AsByteSlice instead or after this function call. Also do not leak result to heap if you want to stay safe.

func ToString

func ToString(v interface{}) string

ToString - Accepts only slices, arrays, strings and pointers to primitives. Primitives converts to string with len up to its sizeof. Returns "" if fails

NOTE: it permanently transmutates original value if its element size is larger than destination one. Use AsString instead or after this function call. Also do not leak result to heap if you want to stay safe.

func Union

func Union(struc interface{})

Union -

Types

type Caster

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

Caster -

func Cast

func Cast(v interface{}) Caster

Cast -

func (*Caster) AsByteSlice

func (c *Caster) AsByteSlice(v interface{}) (result []byte)

AsByteSlice -

func (*Caster) AsInt

func (c *Caster) AsInt(v interface{}) (result int)

AsInt -

func (*Caster) AsString

func (c *Caster) AsString(v interface{}) (result string)

AsString -

func (*Caster) ToByteSlice

func (c *Caster) ToByteSlice() []byte

ToByteSlice -

func (*Caster) ToString

func (c *Caster) ToString() string

ToString -

Jump to

Keyboard shortcuts

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