utils

package
v1.12.9 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetElemOrDefaultFromMap added in v1.10.1

func GetElemOrDefaultFromMap[T int | uint64](m map[string]string, key string, def T) T

GetElemOrDefaultFromMap returns the value of a key from a map, or a default value if the key does not exist or the value is not of the expected type.

func GetIntValFromString added in v1.12.0

func GetIntValFromString(val string, defaultValue int) int

GetIntValFromString returns an int value if the string is not empty and is a correct integer OR default value.

func GetIntValOrDefault added in v1.10.1

func GetIntValOrDefault(val int, defaultValue int) int

GetIntValOrDefault returns an int value if greater than 0 OR default value.

func IsTruthy

func IsTruthy(val string) bool

IsTruthy returns true if a string is a truthy value. Truthy values are "y", "yes", "true", "t", "on", "1" (case-insensitive); everything else is false.

func Unquote added in v1.10.1

func Unquote(data []byte) (res string)

Unquote parses a request data that may be quoted due to JSON encoding, and removes the quotes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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