Documentation
¶
Index ¶
- Variables
- func CloneMap[M ~map[K]V, K comparable, V any](m M) M
- func DeepCopy(src, dest any) error
- func DownloadFileHash(ctx context.Context, httpClient *http.Client, useragent string, ...) (int64, error)
- func IsFalse(value string) bool
- func IsFalseOrEmpty(value string) bool
- func IsNoneOrEmpty(value string) bool
- func IsTrue(value string) bool
- func IsTrueOrEmpty(value string) bool
- func OpenBrowser(url string) error
- func ParseUint32Range(value string) (uint32, uint32, error)
- func PathExists(name string) bool
- func PathIsWritable(path string) bool
- func SplitNTrimSpace(s string, sep string, n int, nilIfEmpty bool) []string
- func StringHasPrefix(value string, prefixes ...string) bool
- func StringPrefixInSlice(key string, list []string) bool
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("resource not found")
ErrNotFound is used to explicitly signal error cases, where a resource can not be found (404 HTTP status code).
Functions ¶
func CloneMap ¶ added in v6.0.3
func CloneMap[M ~map[K]V, K comparable, V any](m M) M
CloneMap returns a copy of m. This is a shallow clone: the new keys and values are set using ordinary assignment.
func DownloadFileHash ¶
func DownloadFileHash(ctx context.Context, httpClient *http.Client, useragent string, progress func(progress ioprogress.ProgressData), canceler *cancel.HTTPRequestCanceller, filename string, url string, hash string, hashFunc hash.Hash, target io.WriteSeeker) (int64, error)
func IsFalseOrEmpty ¶
IsFalseOrEmpty returns true if value is empty or if IsFalse() returns true.
func IsNoneOrEmpty ¶ added in v6.9.0
IsNoneOrEmpty returns true if value is empty or a "none" value.
func IsTrueOrEmpty ¶
IsTrueOrEmpty returns true if value is empty or if IsTrue() returns true.
func OpenBrowser ¶ added in v6.0.3
OpenBrowser opens the provided URL in the default web browser.
func ParseUint32Range ¶
ParseUint32Range parses a uint32 range in the form "number" or "start-end". Returns the start number and the size of the range.
func PathExists ¶
func PathIsWritable ¶
func SplitNTrimSpace ¶
SplitNTrimSpace returns result of strings.SplitN() and then strings.TrimSpace() on each element. Accepts nilIfEmpty argument which if true, will return nil slice if s is empty (after trimming space).
func StringHasPrefix ¶
StringHasPrefix returns true if value has one of the supplied prefixes.
func StringPrefixInSlice ¶
StringPrefixInSlice returns true if any element in the list has the given prefix.
Types ¶
This section is empty.