package
0.0.0-20240701064118-96e69a6460fb
Repository: https://github.com/relex/slog-agent.git
Documentation: pkg.go.dev
# Packages
Package localcachedmap provides a map with thread-local caches (copy-on-reference).
Package stringtemplate provides string expansion by pre-compiled templates, for example:
vehicle1 := map[string]string{"type": "Car", "color": "Red", "model": "X001"} tag := NewStringMapExpander("${color[:1]}-$type").Expand(vehicle1) // tag == "R-Car"
Only named fields are supported.
Package stringunescape provides Unescaper(s) for escaped strings.
No description provided by the author
# Functions
BytesFromString makes a []byte pointing to the contents of a string.
No description provided by the author
CollectFromChannel collect remaining items from a CLOSED channel.
CopySlice copies the slice to a newly-allocated one.
DeepCopyString copies the given string to a newly-allocated one
Without references to the original backing bytes.
DeepCopyStringFromBytes copies the given []byte to a newly-allocated string
Without references to the original backing bytes.
DeepCopyStrings copies the given string list including each of item to newly allocated fields
Without references to the original backing slices.
GetFDFromTCPConn reads socket FD from the given connection.
GetFDFromTCPConnOrPanic tries to get socket FD from the given connection or panic
The connection must have been established first.
GetYamlLocation fetches a descriptive location of YAML node.
IsNetworkClosed checks if the given error tells closing of network connection.
IsNetworkError checks whether the given error should be considered a network issue, as opposed to e.g.
IsNetworkTimeout checks if the given error is network timeout.
IsTestGenerationMode returns true if we're running in "go test -args gen" to generate expected test outputs.
ListFiles lists non-dir files or first level files under the directories in the given path pattern.
MarshalYaml marshals the given source to a YAML string.
MaxInt returns the larger one of given integers.
MD5ToHexdigest computes MD5 for given string and returns hex.
MinInt returns the smaller one of given integers.
NewBytesPoolBy2n creates a BytesPoolBy2n with all pools initialized.
NewRunOnce creates a function that would call the given "f" at most once.
NewYamlError creates a new error with location information of YAML node.
No description provided by the author
ReadFileAt reads full contents of a file in given directory.
SHA512ToHexdigest computes SHA512 for given string and returns hex.
Stack returns current stack trace as string.
StatFileAt queries the stat of an existing file in given directory.
StringFromBytes makes a string backed by a specified []byte.
TimeFromTimeval creates a Time structure from syscall.Timeval.
TimeToUnixFloat creates Unix epoch seconds from a Time structure.
TrySetTCPReadBuffer attempts to set read buffer within the range given.
UnlinkFileAt unlinks an existing file in given directory.
UnmarshalYamlFile loads and unmarshals YAML from file to interface or pointer to struct.
UnmarshalYamlReader loads and unmarshals YAML from IO reader to interface or pointer to struct.
UnmarshalYamlString loads and unmarshals YAML in string to interface or pointer to struct.
WrapNetConn creates a NetConnWrapper for given network connection.
WriteFileAt writes to a new file in given directory.
# Structs
NetConnWrapper wraps a connection with with timeouts updated infrequently in trade of accuracy The real timeouts could be anything from specified timeout values to double of them.
No description provided by the author
# Type aliases
BytesPoolBy2n is a set of pools by size
BytesPoolBy2n[1] = pool of make([]byte, 2) BytesPoolBy2n[2] = pool of make([]byte, 4) BytesPoolBy2n[8] = pool of make([]byte, 256) ..
MutableString is a string backed by raw []byte, instead of in the immutable memory area like normal Go strings.
RunOnce is a function wrapper that calls the underlying function at most once
beforeRunning is invoked right before the underlying function is invoked and only if it's going to be invoked.