utilfuncs

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2025 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package utilfuncs contains utility related (pure) functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Anyify

func Anyify[T any](items []T) []any

func ArrayIntToArryString

func ArrayIntToArryString(strings []int) []string

func ArrayWithValue

func ArrayWithValue(size int, s string) []string

func CreateTimeFromYYYYMMDDZoneSecs added in v0.7.0

func CreateTimeFromYYYYMMDDZoneSecs(yyyymmdd uint, timezoneUTCSeconds, daySeconds int) time.Time

func DaySeconds

func DaySeconds(t *time.Time) uint

func DayUTCOffsetSecs added in v0.5.0

func DayUTCOffsetSecs(t *time.Time) int

func DayYYYYMMDD

func DayYYYYMMDD(t *time.Time) uint

func DistHaversine

func DistHaversine(a, b [2]float64) float64

func DurationFormatSecs

func DurationFormatSecs(seconds uint) string

func Fif added in v0.8.2

func Fif[T any](cond bool, trueVal, falseVal T) T

func FilterMapByKeys

func FilterMapByKeys[TK comparable, TV any](m map[TK]TV, validKeys []TK) map[TK]TV

func Flatten

func Flatten[T any](arrArrs [][]T) []T

func IntArrayToStringArray

func IntArrayToStringArray(arrInt []int) []string

func IntArraysSortedFilter

func IntArraysSortedFilter(intArrays [][]int) [][]int

func ItemInArray

func ItemInArray[T comparable](item T, items []T) bool

func KeyValues added in v0.6.0

func KeyValues(m map[string]int) []any

func MapKeys

func MapKeys[TK comparable, TV any](m map[TK]TV) []TK

func MapValueAdd

func MapValueAdd(m map[string]uint, value int) map[string]int

func MaxInt

func MaxInt(a, b uint) uint

func Pairs

func Pairs[T any](items []T) [][]T

func StringInArray

func StringInArray(items []string, findItem string) bool

func TemplateExecute added in v0.5.0

func TemplateExecute(templateStr string, context map[string]any) (string, error)

func TimeHMSFormatSecs

func TimeHMSFormatSecs(seconds uint) string

TODO: is this better to do via time package (AM/PM formatting free then?)

func TimezoneToUTCDeltaMap added in v0.7.0

func TimezoneToUTCDeltaMap(timezones []string, yyyymmdd uint) (map[string]int, error)

func TimezoneToUTCDeltaSecs added in v0.5.0

func TimezoneToUTCDeltaSecs(yyyymmdd uint, timezone string) (int, error)

func UniqueInts added in v0.8.3

func UniqueInts(items []int) []int

Types

This section is empty.

Jump to

Keyboard shortcuts

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