conversion

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package conversion provides utilities for converting between types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON added in v1.2.0

func FromJSON(jsonStr string, target interface{}) error

FromJSON converts a JSON string to a Go value.

func ToBool

func ToBool(value interface{}) (bool, error)

ToBool converts a value to bool.

func ToFloat32 added in v1.2.0

func ToFloat32(value interface{}) (float32, error)

ToFloat32 converts a value to float32.

func ToFloat64

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

ToFloat64 converts a value to float64.

func ToInt

func ToInt(value interface{}) (int, error)

ToInt converts a value to int.

func ToInt64 added in v1.2.0

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

ToInt64 converts a value to int64.

func ToJSON added in v1.2.0

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

ToJSON converts a Go value to a JSON string.

func ToMap

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

ToMap converts a value to map[string]interface{}.

func ToPrettyJSON added in v1.2.0

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

ToPrettyJSON converts a Go value to a formatted JSON string with indentation.

func ToSlice

func ToSlice(value interface{}) ([]interface{}, error)

ToSlice converts a value to []interface{}.

func ToString

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

ToString converts a value to string.

func ToTime added in v1.2.0

func ToTime(value interface{}) (time.Time, error)

ToTime converts a value to time.Time.

func ToUint64 added in v1.2.0

func ToUint64(value interface{}) (uint64, error)

ToUint64 converts a value to uint64.

Types

This section is empty.

Jump to

Keyboard shortcuts

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