convertor

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StructToMap

func StructToMap(value interface{}) (map[string]interface{}, error)

StructToMap convert struct to map, only convert exported struct field map key is specified same as struct field tag `json` value

func ToBytes

func ToBytes(data interface{}) ([]byte, error)

ToBytes convert interface to bytes

func ToFloat64

func ToFloat64(value interface{}) (float64, error)

ToFloat64 convert value to a float64, if input is not a float return 0.0 and error

func ToInt64

func ToInt64(value interface{}) (int64, error)

ToInt64 convert value to a int64, if input is not a numeric format return 0 and error

func ToJson

func ToJson(value interface{}) (string, error)

ToJson convert value to a valid json string

func ToString

func ToString(value interface{}) string

ToString convert value to string

Types

This section is empty.

Jump to

Keyboard shortcuts

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