Documentation ¶
Index ¶
- Constants
- func ContainsString(arr []string, v string) bool
- func GetReadableDuration(durationStr string) (string, error)
- func IsInteger(val float64) bool
- func IsValidUUID(u string) bool
- func MapToSlice(m map[string]string) []string
- func ReturnJSON(w http.ResponseWriter, data interface{})
- func StructToMap(v interface{}) (map[string]interface{}, error)
- func SubsliceExists(slice, subslice []string) (bool, int)
- func ValidateStruct(v interface{}) error
- type AnyTime
- type HTTPClient
Constants ¶
View Source
const (
PermanentDurationLabel = "Permanent"
)
Variables ¶
This section is empty.
Functions ¶
func ContainsString ¶
func GetReadableDuration ¶ added in v0.7.1
GetReadableDuration returns a human-readable duration string in integer days preferably, or the original string if it's either not a valid duration or a days value is not integer.
func IsValidUUID ¶ added in v0.7.3
IsValidUUID returns true if uuid is valid
func MapToSlice ¶ added in v0.7.2
MapToSlice converts map[string]string to []string
Example:
Input: map[string]string{ "key1": "value1", "key2": "value2", "key3": "value3"} Output: []string{"key1=value1", "key2=value2", "key3=value3"}
func ReturnJSON ¶
func ReturnJSON(w http.ResponseWriter, data interface{})
ReturnJSON writes JSON to the response body
func StructToMap ¶ added in v0.7.5
StructToMap converts a struct to a map using json marshalling
func SubsliceExists ¶
func ValidateStruct ¶
func ValidateStruct(v interface{}) error
ValidateStruct validates the struct and returns error if there is any invalid values
Types ¶
Click to show internal directories.
Click to hide internal directories.