helpers

package
v0.0.0-...-b1b3a06 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatchErrorSentry

func CatchErrorSentry(err error)

CatchErrorSentry -

func CatchPanicSentry

func CatchPanicSentry()

CatchPanicSentry -

func CleanPath

func CleanPath(path string) string

CleanPath makes a path safe for use with filepath.Join. This is done by not only cleaning the path, but also (if the path is relative) adding a leading '/' and cleaning it (then removing the leading '/'). This ensures that a path resulting from prepending another path will always resolve to lexically be a subdirectory of the prefixed path. This is all done lexically, so paths that include symlinks won't be safe as a result of using CleanPath.

func Escape

func Escape(str string) string

Escape -

func GenerateID

func GenerateID() string

GenerateID -

func GetLocalSentry

func GetLocalSentry() *sentry.Hub

GetLocalSentry -

func InitSentry

func InitSentry(cfg SentryConfig)

InitSentry -

func IsIPFS

func IsIPFS(hash string) bool

IsIPFS -

func IsInt64PointersEqual

func IsInt64PointersEqual(a, b *int64) bool

IsInt64PointersEqual -

func LocalCatchErrorSentry

func LocalCatchErrorSentry(hub *sentry.Hub, err error)

LocalCatchErrorSentry -

func Max

func Max[T Number](a, b T) T

Max -

func Min

func Min[T Number](a, b T) T

Min -

func QuarterBoundaries

func QuarterBoundaries(current time.Time) (time.Time, time.Time, error)

QuarterBoundaries -

func QuarterOf

func QuarterOf(month time.Month) int

QuarterOf -

func SetLocalTagSentry

func SetLocalTagSentry(hub *sentry.Hub, key, value string)

SetLocalTagSentry -

func SetTagSentry

func SetTagSentry(key, value string)

SetTagSentry -

func SetUserIDSentry

func SetUserIDSentry(id string)

SetUserIDSentry -

func Slug

func Slug(alias string) string

Slug -

func SpaceStringsBuilder

func SpaceStringsBuilder(str string) string

SpaceStringsBuilder -

func StringInArray

func StringInArray(s string, arr []string) bool

StringInArray -

func URLJoin

func URLJoin(baseURL, queryPath string) (string, error)

URLJoin -

Types

type Number

type Number interface {
	~int64 | ~float64 | ~int | ~float32
}

Number -

type SentryConfig

type SentryConfig struct {
	DSN   string
	Debug bool
	Env   string
	Tags  map[string]string
}

type Set

type Set[T SetKey] map[T]struct{}

Set -

func (Set[T]) Add

func (s Set[T]) Add(item T)

Add - add item to set

func (Set[T]) Append

func (s Set[T]) Append(str ...T)

Append - append items to set

func (Set[T]) Len

func (s Set[T]) Len() int

Len - returns length of set

func (Set[T]) Merge

func (s Set[T]) Merge(m Set[T])

Merge -

func (Set[T]) Values

func (s Set[T]) Values() []T

Values - return keys

type SetKey

type SetKey interface {
	~string
}

SetKey -

Jump to

Keyboard shortcuts

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