typeconv

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

Package to help convert safely interface{} values into specific types

Index

Constants

View Source
const IntSize = 32 << (^uint(0) >> 32 & 1) // 32 or 64

Variables

This section is empty.

Functions

func AsInt

func AsInt(v interface{}) (int, bool)

AsInt tries to convert data into an int

func AsInt8

func AsInt8(v interface{}) (int8, bool)

AsInt8 tries to convert data into an int8

func AsInt8Slice

func AsInt8Slice(v interface{}) ([]int8, bool)

AsInt8Slice tries to convert data into a slice of int8

func AsInt16

func AsInt16(v interface{}) (int16, bool)

AsInt16 tries to convert data into an int16

func AsInt16Slice

func AsInt16Slice(v interface{}) ([]int16, bool)

AsInt16Slice tries to convert data into a slice of int16

func AsInt32

func AsInt32(v interface{}) (int32, bool)

AsInt32 tries to convert data into an int32

func AsInt32Slice

func AsInt32Slice(v interface{}) ([]int32, bool)

AsInt32Slice tries to convert data into a slice of int32

func AsInt64

func AsInt64(v interface{}) (int64, bool)

AsInt64 tries to convert data into an int64

func AsInt64Slice

func AsInt64Slice(v interface{}) ([]int64, bool)

AsInt64Slice tries to convert data into a slice of int64

func AsIntN

func AsIntN(v interface{}, bitsize int) (int64, bool)

AsIntN tries to convert data into an int of given size

func AsIntSlice

func AsIntSlice(v interface{}) ([]int, bool)

AsIntSlice tries to convert data into a slice of int

func AsSlice

func AsSlice(v interface{}) ([]interface{}, bool)

AsInt tries to convert data into a slice of something

func AsString

func AsString(v interface{}) (string, bool)

AsInt tries to convert data into a string

func AsStringSlice

func AsStringSlice(v interface{}) ([]string, bool)

AsStringSlice tries to convert data into a slice of string

func AsUint

func AsUint(v interface{}) (uint, bool)

AsInt tries to convert data into a uint

func AsUint8

func AsUint8(v interface{}) (uint8, bool)

AsUint8 tries to convert data into a uint8

func AsUint8Slice

func AsUint8Slice(v interface{}) ([]uint8, bool)

AsUint8Slice tries to convert data into a slice of uint8

func AsUint16

func AsUint16(v interface{}) (uint16, bool)

AsUint16 tries to convert data into a uint16

func AsUint16Slice

func AsUint16Slice(v interface{}) ([]uint16, bool)

AsUint16Slice tries to convert data into a slice of uint16

func AsUint32

func AsUint32(v interface{}) (uint32, bool)

AsUint32 tries to convert data into a uint32

func AsUint32Slice

func AsUint32Slice(v interface{}) ([]uint32, bool)

AsUint32Slice tries to convert data into a slice of uint32

func AsUint64

func AsUint64(v interface{}) (uint64, bool)

AsUint64 tries to convert data into a uint64

func AsUint64Slice

func AsUint64Slice(v interface{}) ([]uint64, bool)

AsUint64Slice tries to convert data into a slice of uint64

func AsUintN

func AsUintN(v interface{}, bitsize int) (uint64, bool)

AsUintN tries to convert data into a uint of given size

func AsUintSlice

func AsUintSlice(v interface{}) ([]uint, bool)

AsUintSlice tries to convert data into a slice of uint

Types

This section is empty.

Jump to

Keyboard shortcuts

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