Documentation
¶
Index ¶
- Variables
- func BitFieldContains[T constraints.Integer](bf T, vals ...T) bool
- func BitFieldUnset[T constraints.Integer](bf T, vals ...T) T
- func CanonicalAbsPath(path string) (string, error)
- func CanonicalPath(path string) string
- func IsIPv4(address string) bool
- func IsIPv6(address string) bool
- func MapKeys[M ~map[K]V, K comparable, V any](m M, options ...MapOption[K]) []K
- func MapValues[M ~map[K]V, K comparable, V any](m M, options ...MapOption[V]) []V
- func MergeArray[T comparable](a, b []T) []T
- func MergeMapExt[K comparable, V any](a, b map[K]V, mergeValue func(key K, valA, valB V) V) map[K]V
- func Must[T any](o T, err error) T
- func MustCanonicalAbsPath(path string) string
- func NewErrChannelIO(format string, a ...any) error
- func NewErrIntentional(format string, a ...any) error
- func NewErrInvalidArg(format string, a ...any) error
- func NewErrItemNotFound(format string, a ...any) error
- func NewErrNetClosing(format string, a ...any) error
- func NewErrNotImplemented(format string, a ...any) error
- func NewErrResourceUnavailable(format string, a ...any) error
- func NewErrTimeoutExceeded(format string, a ...any) error
- func NewErrUnexpectedResult(format string, a ...any) error
- func OpenBrowser(rawURL string) error
- func RoundedDuration(d time.Duration, decimal int) time.Duration
- func UnmarshalWithAlteredTags[T any](fieldNameTags map[string]string, unmarshalF func([]byte, any) error, ...) (T, error)
- type MapOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrChannelIO indicates a channel I/O error ErrChannelIO = errors.New("channel IO error") // ErrInvalidArg indicates an invalid argument has been encountered, most // likely an unexpected nil pointer. ErrInvalidArg = errors.New("invalid argument") // ErrUnexpectedResult indicates an unexpected result from a operation. ErrUnexpectedResult = errors.New("return value of operation invalid") // unavailable resource. ErrResourceUnavailable = errors.New("resource unavailable") // ErrItemNotFound indicates that the retrieval of a queryable resource from // a collection produced an empty set. ErrItemNotFound = errors.New("item not found") // ErrNotImplemented indicates that functionality is not available. ErrNotImplemented = errors.New("not implemented (yet)") // ErrTimeoutExceeded indicates, that a timeout has been exceeded ErrTimeoutExceeded = errors.New("timeout exceeded") // ErrIntentional indicates, that an error has been intentionally // generated; mostly used in tests. ErrIntentional = errors.New("intentional") // ErrNetClosing is returned when a network descriptor is used after // it has been closed. Keep this string consistent because of issue // #4373: since historically programs have not been able to detect // this error, they look for the string. ErrNetClosing = errors.New("use of closed network connection") )
Functions ¶
func BitFieldContains ¶
func BitFieldContains[T constraints.Integer](bf T, vals ...T) bool
BitFieldContains checks, whether all vals are contained in the field bf.
func BitFieldUnset ¶
func BitFieldUnset[T constraints.Integer](bf T, vals ...T) T
BitFieldUnset unsets vals in the field bf.
func CanonicalAbsPath ¶
CanonicalAbsPath returns an absolute representation of to path after potentially replacing environment variable references. See also filepath.Abs()
func CanonicalPath ¶
CanonicalPath returns the shortest path name equivalent to path after potentially replacing environment variable references. See also filepath.Clean()
func MapKeys ¶
func MapKeys[M ~map[K]V, K comparable, V any](m M, options ...MapOption[K]) []K
MapKeys returns the keys of the map m.
func MapValues ¶
func MapValues[M ~map[K]V, K comparable, V any](m M, options ...MapOption[V]) []V
MapValues returns the values of the map m.
func MergeArray ¶
func MergeArray[T comparable](a, b []T) []T
MergeArray always returns a new array with the merged, unique values of the arrays a and b.
func MergeMapExt ¶
func MergeMapExt[K comparable, V any](a, b map[K]V, mergeValue func(key K, valA, valB V) V) map[K]V
MergeMapExt always returns a new map containing the result of merging maps a and b. If the same key exists in both maps, mergeValue is called to decide the resulting value for the key.
func Must ¶
Must is a simple wrapper implementing the commonly user "Must"-pattern in Go, e.g., regexp.MustCompilePOSIX(). see https://stackoverflow.com/a/73584801
func MustCanonicalAbsPath ¶
MustCanonicalAbsPath returns an absolute representation of to path after potentially replacing environment variable references. See also filepath.Abs() NOTE This function panics in the unlikely event, that an absolute path cannot be derived.
func NewErrChannelIO ¶
NewErrChannelIO creates a new error wrapped by ErrChannelIO.
func NewErrIntentional ¶
NewErrIntentional creates a new error wrapped by ErrIntentional.
func NewErrInvalidArg ¶
NewErrInvalidArg creates a new error wrapped by ErrInvalidArg.
func NewErrItemNotFound ¶
NewErrItemNotFound creates a new error wrapped by ErrItemNotFound.
func NewErrNetClosing ¶
NewErrNetClosing creates a new error wrapped by ErrNetClosing.
func NewErrNotImplemented ¶
NewErrNotImplemented creates a new error wrapped by ErrNotImplemented.
func NewErrResourceUnavailable ¶
NewErrResourceUnavailable creates a new error wrapped by ErrResourceUnavailable.
func NewErrTimeoutExceeded ¶
NewErrTimeoutExceeded creates a new error wrapped by ErrTimeoutExceeded.
func NewErrUnexpectedResult ¶
NewErrUnexpectedResult creates a new error wrapped by ErrUnexpectedResult.
func OpenBrowser ¶
OpenBrowser ... see https://gist.github.com/hyg/9c4afcd91fe24316cbf0
func RoundedDuration ¶
RoundedDuration returns a duration with the corresponding number of decimal places.
Types ¶
type MapOption ¶
type MapOption[T any] func(*mapOptionArg[T])
A MapOption allows for additional configuration of the MapKeys() and MapValues() functions.
func MapFilterOption ¶
MapFilterOption sets an optional filter to be applied to the keys or values returned by MapKeys() or MapValues().