utils

package
v0.0.0-...-11d73a2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayInsert

func ArrayInsert[T any](slice []T, index int, value T) []T

func ArrayRemove

func ArrayRemove[T any](slice []T, index int) []T

func ConfigFromJson

func ConfigFromJson[T interface{}](path string, output *T) error

Takes in an input path to a json file and fills an output struct based on struct tags using json unmarshal

func ExecutableDir

func ExecutableDir() string

func FileExtension

func FileExtension(file string) string

func First

func First[T any](first T, rest ...any) T

func FixDirPath

func FixDirPath(path_in string) string

returns a fixed path, which means it ends with "/"

func ForEach

func ForEach[T any](in []T, cb func(T))

func MapArray

func MapArray[T any, U any](in []T, cb func(T) U) []U

func MapContains

func MapContains[T comparable, U any](in map[T]U, key T) bool

func MaxIndex

func MaxIndex[T cmp.Ordered](in []T) int

func PanicOnErr

func PanicOnErr(e error)

func Second

func Second[T any](first any, second T, rest ...any) T

Types

type FileInfo

type FileInfo struct {
	IsDir bool
	Name  string
}

type FileList

type FileList []FileInfo

func FileListGlob

func FileListGlob(fl *FileList, regex string, keep_match bool) FileList

keep or delete files what match a regex

func FilesInDir

func FilesInDir(dir string, show_dirs bool, recursive bool) FileList

read all files and dirs in a directory, recursively or not it does not include the initial directory name

type WaitTimer

type WaitTimer struct {
	// contains filtered or unexported fields
}

func CreateWaitTimer

func CreateWaitTimer(duration_s float64) WaitTimer

func (*WaitTimer) Check

func (t *WaitTimer) Check() bool

func (*WaitTimer) Reset

func (t *WaitTimer) Reset()

func (*WaitTimer) SetDuration

func (t *WaitTimer) SetDuration(d float64)

Jump to

Keyboard shortcuts

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