util

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DOMAIN = "https://thunderstore.io/"
View Source
const REQ_TIMEOUT = 10 * time.Second

Variables

This section is empty.

Functions

func CheckSemVer added in v0.4.0

func CheckSemVer(version string) (bool, error)

func Exclude added in v0.6.0

func Exclude[T any, V comparable](list []T, subset []V, match func(T, V) bool) []T

func JsonGetRequest

func JsonGetRequest[T interface{}](endpoint string) (T, error)

func JsonPostRequest

func JsonPostRequest[T interface{}](endpoint string, body any) (T, error)

func PrettyPrint added in v0.2.0

func PrettyPrint(i interface{})

Prints the interface to STDOUT in a readable way.

func TryFind added in v0.3.0

func TryFind[T any](arr []T, pred func(pkg T) bool) *T

func Zero added in v0.6.0

func Zero(v interface{}) bool

Types

type DateTime

type DateTime struct {
	time.Time
}

An alias for time.Time that is correctly unmarshalled from JSON.

func (DateTime) Humanize added in v0.3.0

func (dt DateTime) Humanize() string

Formats this date into a relative string like so:

"6 seconds ago", "2 months ago" or "3 days from now"

func (*DateTime) UnmarshalJSON

func (dt *DateTime) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL