Documentation
¶
Index ¶
- Variables
- func AppendByteSize[T ~int | ~uint | ~int64 | ~uint64 | ~float64](size T, buf []byte) []byte
- func AppendDuration(d time.Duration, buf []byte) []byte
- func AppendTime(t time.Time, buf []byte) []byte
- func AppendTimeWithReference(t, ref time.Time, buf []byte) []byte
- func CommaSeperatedList(s string) []string
- func DoYouMean(s string) string
- func FormatByteSize[T ~int | ~uint | ~int64 | ~uint64 | ~float64](size T) string
- func FormatDuration(d time.Duration) string
- func FormatLastSeen(t time.Time) string
- func FormatTime(t time.Time) string
- func FormatTimeWithReference(t, ref time.Time) string
- func FormatUnixTime(t int64) string
- func GlobMatch(pattern string, s string) bool
- func IsValidFilename(filename string) bool
- func JoinLines(elems []string) string
- func JoinRune(elems []string, sep rune) string
- func LevenshteinDistance(a, b string) int
- func MustParse[T Parser](from string) T
- func Parse[T Parser](from string) (t T, err error)
- func Pluralize(n int64) string
- func SanitizeURI(uri string) string
- func SplitComma(s string) []string
- func SplitLine(s string) []string
- func SplitRune(s string, sep rune) []string
- func SplitSpace(s string) []string
- func Title(s string) string
- func ToLowerNoSnake(s string) string
- type Parser
Constants ¶
This section is empty.
Variables ¶
View Source
var Atoi = strconv.Atoi
Functions ¶
func AppendByteSize ¶ added in v0.11.0
func AppendDuration ¶ added in v0.11.0
AppendDuration appends a duration to a buffer with the following format:
- 1 ns
- 1 ms
- 1 seconds
- 1 minutes and 1 seconds
- 1 hours, 1 minutes and 1 seconds
- 1 days, 1 hours and 1 minutes (ignore seconds if days >= 1)
func AppendTimeWithReference ¶ added in v0.11.0
func CommaSeperatedList ¶
CommaSeperatedList returns a list of strings split by commas, then trim spaces from each element.
func FormatByteSize ¶ added in v0.10.0
func FormatDuration ¶
func FormatLastSeen ¶
func FormatTime ¶
func FormatTimeWithReference ¶ added in v0.11.0
func FormatUnixTime ¶ added in v0.11.0
func IsValidFilename ¶ added in v0.10.0
IsValidFilename checks if a filename is safe and doesn't contain path traversal attempts Returns true if the filename is valid, false otherwise
func LevenshteinDistance ¶
func SanitizeURI ¶ added in v0.9.10
SanitizeURI sanitizes a URI reference to ensure it is safe It disallows URLs beginning with // or /\ as absolute URLs, cleans the URL path to remove any .. or . path elements, and ensures the URL starts with a / if it doesn't already
func SplitComma ¶
SplitComma is a wrapper around SplitRune(s, ',').
func SplitSpace ¶
SplitSpace is a wrapper around SplitRune(s, ' ').
func ToLowerNoSnake ¶
Types ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.