utilfuncs

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

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 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 Coord) float64

func DurationFormatSecs

func DurationFormatSecs(seconds uint) string

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 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 TimezoneToUTCDeltaSecs added in v0.5.0

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

Types

type Coord

type Coord struct {
	Lat float64 `yaml:"lat" json:"lat"`
	Lon float64 `yaml:"lon" json:"lon"`
}

Jump to

Keyboard shortcuts

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