Help us shape the future of Go! Take the 2026 Go Developer Survey

convert

package
v1.37.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromHttpResponse

func FromHttpResponse(res *http.Response, v any) error

FromHttpResponse reads the response body from the specified http response and converts it into the specified value

func ParseDuration

func ParseDuration(value string) (time.Duration, error)

func ToJsonArray

func ToJsonArray(value any) ([]any, error)

ToJsonArray converts the specified value (slice) to a json array

func ToMap

func ToMap(value any) (map[string]any, error)

Converts the specified value to a map.

func ToStringWithDefault

func ToStringWithDefault(value any, defaultValue string) string

Attempts to convert the specified value to a string, otherwise returns the default value

func ToValueWithDefault

func ToValueWithDefault[T any](ptr *T, defaultValue T) T

Converts a pointer to a value type If the ptr is nil returns default value, otherwise the value of value of the pointer

Types

This section is empty.

Jump to

Keyboard shortcuts

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