helper

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyToArrayOfString added in v0.5.0

func AnyToArrayOfString(v any) ([]string, error)

func AnyToFloat added in v0.5.0

func AnyToFloat(v any) (float64, error)

func AnyToString added in v0.5.0

func AnyToString(v any) (string, error)

func AnyToType added in v0.5.0

func AnyToType(in any, expected reflect.Type) (out any, err error)

func ArrayToArrayOfAny added in v0.5.0

func ArrayToArrayOfAny(v any) ([]any, error)

func ArrayToArrayOfType added in v0.5.0

func ArrayToArrayOfType(a []any, expectedValue reflect.Type) (reflect.Value, error)

func CheckValidPointerToStruct added in v0.4.0

func CheckValidPointerToStruct(in any) error

Checks if the given value is a pointer to a struct.

func ConditionValueToArrayOfAny added in v0.5.0

func ConditionValueToArrayOfAny(condition string, expected reflect.Type) ([]any, error)

func ConditionValueToT added in v0.5.0

func ConditionValueToT[T comparable](v T, condition string) (T, error)

func GetValidMap added in v0.5.0

func GetValidMap(in any) (map[string]any, error)

func ISO8601StringToTime added in v0.5.0

func ISO8601StringToTime(in string) (time.Time, error)

ISO8601StringToTime converts an ISO8601 date string to a time.Time object. It checks the format of the string and parses it accordingly. It supports various formats including local time, UTC time, with and without microseconds.

func IsArray added in v0.4.0

func IsArray(in any) bool

Checks if the given value is an array or slice.

func IsArrayOfMap added in v0.4.0

func IsArrayOfMap(in any) bool

Checks if the given value is an array of maps.

func IsArrayOfStruct added in v0.4.0

func IsArrayOfStruct(in any) bool

Checks if the given value is an array or slice of structs.

func IsString added in v0.4.0

func IsString(in any) bool

Checks if the given value is a string.

func IsStruct added in v0.5.0

func IsStruct(in any) bool

Checks if the given value is a struct.

func JsonMapToMapKV added in v0.5.0

func JsonMapToMapKV(m map[string]any, expectedKey reflect.Type, expectedValue reflect.Type) (reflect.Value, error)

func MapJsonMapToStruct added in v0.5.0

func MapJsonMapToStruct(jsonMapInput map[string]any, structToUpdate any) error

func MapKeysToArrayOfAny added in v0.5.0

func MapKeysToArrayOfAny(v any) ([]any, error)

func SetStructValueByJson added in v0.5.0

func SetStructValueByJson(fv reflect.Value, jsonValue any) (err error)

func UnixStringToTime added in v0.5.0

func UnixStringToTime(in string) (time.Time, error)

UnixStringToTime converts a Unix timestamp string to a time.Time object. It checks if the string is a valid Unix timestamp and parses it.

func UnmapRequestToJsonMap added in v0.5.0

func UnmapRequestToJsonMap(request *http.Request) (map[string]any, error)

func UnmapStructToJsonMap added in v0.5.0

func UnmapStructToJsonMap(structInput any, jsonMapToUpdate *map[string]any) error

func UnmapUrlValuesToJsonMap added in v0.5.0

func UnmapUrlValuesToJsonMap(values url.Values) (map[string]any, error)

func UnmarshalJsonToJsonMap added in v0.5.0

func UnmarshalJsonToJsonMap(jsonInput []byte) (map[string]any, error)

func UnmarshalRequestToJsonMap added in v0.5.0

func UnmarshalRequestToJsonMap(request *http.Request) (map[string]any, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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