Documentation
¶
Index ¶
- Constants
- Variables
- func AddElemToSliceUniq[T comparable](arr []T, elem T) []T
- func BoundValue(val, minVal, maxVal int) int
- func CalculateDeltas(values []float64) []float64
- func ConvertToWallClockPT(t time.Time) time.Time
- func CopyStrArr(arr []string) []string
- func DrainChan[T any](ch chan T)
- func ExpandHomeDir(pathStr string) string
- func GetGoroutineID() int64
- func GetHomeDir() string
- func GetJsonTag(field reflect.StructField) string
- func GetOrderedMapKeys[V any](m map[string]V) []string
- func IndentString(indent string, str string) string
- func MoveSliceIdxToFront[T any](arr []T, idx int) []T
- func NeedsLock(rval reflect.Value) bool
- func ParseNameAndTags(input string) (string, []string)
- func ParseTags(input string) []string
- func ReUnmarshal(out any, in any) error
- func RemoveElemFromSlice[T comparable](arr []T, elem T) []T
- func SliceIdx[T comparable](arr []T, elem T) int
- func StarMatchString(pattern string, s string, delimiter string) bool
- func TeeCopy(src io.Reader, dst io.Writer, dataCallbackFn func([]byte)) error
- func TryLockWithTimeout(locker sync.Locker, timeout time.Duration) (bool, time.Duration)
- func WriteFileIfDifferent(fileName string, contents []byte) (bool, error)
- type LineBuf
Constants ¶
const MaxLineLength = 64 * 1024
Variables ¶
var PTLoc *time.Location
Functions ¶
func AddElemToSliceUniq ¶
func AddElemToSliceUniq[T comparable](arr []T, elem T) []T
func BoundValue ¶
func CalculateDeltas ¶
CalculateDeltas converts a slice of values to deltas between consecutive values The first value is kept as is, and subsequent values are the difference from the previous value If a value is exactly 0, it's treated as a counter reset and outputs 0 (not a negative delta)
func CopyStrArr ¶
func ExpandHomeDir ¶
func GetGoroutineID ¶
func GetGoroutineID() int64
func GetHomeDir ¶
func GetHomeDir() string
func GetJsonTag ¶
func GetJsonTag(field reflect.StructField) string
func GetOrderedMapKeys ¶
func IndentString ¶
func MoveSliceIdxToFront ¶
func ParseNameAndTags ¶
func ReUnmarshal ¶
func RemoveElemFromSlice ¶
func RemoveElemFromSlice[T comparable](arr []T, elem T) []T
removes an element from a slice and modifies the original slice (the backing elements) if it removes the last element from the slice, it will return nil so we free the original slice's backing memory
func SliceIdx ¶
func SliceIdx[T comparable](arr []T, elem T) int
func StarMatchString ¶
matches a delimited string with a pattern string the pattern string can contain "*" to match a single part, or "**" to match the rest of the string note that "**" may only appear at the end of the string
func TryLockWithTimeout ¶
Types ¶
type LineBuf ¶
type LineBuf struct {
// contains filtered or unexported fields
}
func MakeLineBuf ¶
func MakeLineBuf() *LineBuf
func (*LineBuf) GetPartialAndReset ¶
func (*LineBuf) ProcessBuf ¶
processes the buffer, returns lines (partial lines are retained)