utils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToOptional

func ConvertToOptional[T any](value any) *T

func ConvertToSliceOfInt

func ConvertToSliceOfInt(input any) ([]int, error)

func ConvertToStringMap

func ConvertToStringMap(inputMap map[string]any) map[string]string

ConvertToStringMap converts a map[string]any to map[string]string. It iterates through the input map and includes only the key-value pairs where the value is of type string.

func FileExists added in v0.1.1

func FileExists(filePath string) bool

func GetDefaultValue

func GetDefaultValue[T any](data map[string]any, key string, defaultValue T) T

GetDefaultValue returns the default value if the key is not found in the data Example: GetDefaultValue(data, "headless", false)

func ModelDump

func ModelDump(v any) (map[string]interface{}, error)

func ParseJSON

func ParseJSON(data string, v any) error

func StringifyJSON

func StringifyJSON(v any) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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