type_assertion

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MPL-2.0 Imports: 0 Imported by: 0

Documentation

Overview

type_assertion.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertInterfaceSliceToStringMap

func ConvertInterfaceSliceToStringMap(input interface{}) map[string][]string

ConvertInterfaceSliceToStringMap safely converts an interface slice to a map of string slices.

func ConvertToMapFromInterface

func ConvertToMapFromInterface(value interface{}) map[string]interface{}

ConvertToMapFromInterface safely converts an interface{} to a map[string]interface{}, handling nil values.

func GetBoolFromInterface

func GetBoolFromInterface(val interface{}) bool

GetBoolFromInterface safely retrieves a bool value from an interface{}, handling nil values.

func GetBoolFromMap

func GetBoolFromMap(m map[string]interface{}, key string) bool

GetBoolFromMap safely retrieves a bool value from a map, returning a default value for nil or not found.

func GetInt

func GetInt(val interface{}) int

GetInt safely performs an int type assertion, handling nil values.

func GetIntFromInterface

func GetIntFromInterface(val interface{}) int

GetIntFromInterface safely retrieves an int value from an interface{}, handling nil values.

func GetIntFromMap

func GetIntFromMap(m map[string]interface{}, key string) int

GetIntFromMap safely retrieves an int value from a map, returning a default value for nil or not found.

func GetString

func GetString(val interface{}) string

GetString safely performs a string type assertion, handling nil values.

func GetStringBoolMapFromInterface

func GetStringBoolMapFromInterface(val interface{}) map[string]bool

GetStringBoolMapFromInterface safely retrieves a map[string]bool value from an interface{}, handling nil values and various keys.

func GetStringFromInterface

func GetStringFromInterface(val interface{}) string

GetStringFromInterface safely retrieves a string value from an interface{}, handling nil values.

func GetStringFromMap

func GetStringFromMap(m map[string]interface{}, key string) string

GetStringFromMap safely retrieves a string value from a map, returning a default value for nil or not found.

func GetStringFromSlice

func GetStringFromSlice(slice []interface{}, str string) bool

GetStringFromSlice checks if a string is present in a slice of strings.

func GetStringSliceFromInterface

func GetStringSliceFromInterface(input interface{}) []string

GetStringSliceFromInterface safely converts an interface slice to a string slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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