util

package
v0.0.0-...-6d75b34 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TestRandomString = "pQ8GqKTHv8vgWrtW"

TestRandomString random string for test

Variables

View Source
var TestMode = false

TestMode test mode

Functions

func DiffStrings

func DiffStrings(a, b []string) []string

DiffStrings returns the elements in a that aren't in b

func GenerateULID

func GenerateULID() (string, error)

GenerateULID generate Unique Lexicographically Sortable Identifier

func GetCurrentFuncName

func GetCurrentFuncName() string

GetCurrentFuncName get current function name

func InterfaceSlice

func InterfaceSlice(slice []string) []interface{}

InterfaceSlice helper function to convert []string to []interface{} see https://github.com/golang/go/wiki/InterfaceSlice

func MergeStrings

func MergeStrings(a, b []string) []string

MergeStrings merge string slices

func RandomString

func RandomString(strlen int) string

RandomString generates random string

func StringSliceToMap

func StringSliceToMap(values []string) (map[string]string, error)

StringSliceToMap convert string slice (with key=value strings) to map

Types

type FileWatcher

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

FileWatcher - watches a file on a set interval, and preforms de-duplication of write events such that only 1 write event is reported even if multiple writes happened during the specified duration.

func WatchFile

func WatchFile(path string, interval time.Duration, action func()) (*FileWatcher, error)

WatchFile begin watching a file with a specific interval and action

func (*FileWatcher) Close

func (f *FileWatcher) Close()

Close - closes fsnotify

Jump to

Keyboard shortcuts

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