Documentation ¶
Overview ¶
Contains various utilities used throughout the program. Shouldn't depend on any other part of the program in order to avoid cyclic imports.
data.go, previously various files such as in.go, min.go, slicesEqual.go, etc. contains code for handling various types of data.
Index ¶
- func Delete(path string) error
- func Err(err error, a ...string)
- func Errs(errs []error)
- func GetBreadcrumbs(url string) ([]string, error)
- func GetDoc(url string) (*goquery.Document, error)
- func GetFileHash[T constraints.Integer](path string, bufSize T, hash hash.Hash) ([]byte, error)
- func GetFileMD5[T constraints.Integer](path string, bufSize T) ([]byte, error)
- func GetUpdated(url string) (string, error)
- func In[T comparable](slice []T, item T) bool
- func Info(msg string, a ...any)
- func Min[T constraints.Ordered](a T, numbers ...T) T
- func MonthStrToInt(month string) time.Month
- func ParseWorkshopTimestamp(timestamp string) (time.Time, bool)
- func Sanitise[S ~string](str S) (string, error)
- func SlicesEqual[T constraints.Ordered](a, b []T) bool
- func Test()
- func Unzip(src, dest string) error
- func Warn(warning string, a ...any)
- func WorkshopIDFromURL(url string) (int, error)
- func WorkshopIDToURL(id any) (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBreadcrumbs ¶
func GetFileHash ¶ added in v1.1.0
func GetFileMD5 ¶ added in v1.1.0
func GetFileMD5[T constraints.Integer](path string, bufSize T) ([]byte, error)
func GetUpdated ¶ added in v1.1.0
Gets the Updated timestamp
func In ¶
func In[T comparable](slice []T, item T) bool
Checks if a slice of strings contains an given string.
func Min ¶ added in v1.1.0
func Min[T constraints.Ordered](a T, numbers ...T) T
Pass in any non-zero number of orderables and get back the one that's "smallest" (i.e. it < the rest).
Uses args `a` and `numbers` to ensure at least one value is given.
func MonthStrToInt ¶ added in v1.1.0
func ParseWorkshopTimestamp ¶ added in v1.1.0
func Sanitise ¶ added in v1.3.1
Replaces accents (e.g. 'é' -> 'e'). Converts to lowercase. Replaces whitespace with underscores. Removes all illegal characters.
func SlicesEqual ¶ added in v1.1.0
func SlicesEqual[T constraints.Ordered](a, b []T) bool
Checks if the items and order of two slices are equal
func WorkshopIDFromURL ¶ added in v1.2.0
Extracts the Workshop ID from its URL.
func WorkshopIDToURL ¶ added in v1.2.0
Converts a Workshop ID to a Workshop URL
Types ¶
This section is empty.