utils

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt added in v0.44.0

func Decrypt(ctx context.Context, encKey []byte, encData string) (string, error)

func Encrypt added in v0.44.0

func Encrypt(ctx context.Context, encKey []byte, data string) (string, error)

func IsCtxDone added in v0.44.0

func IsCtxDone(ctx context.Context) bool

func LongestCommonPrefix

func LongestCommonPrefix(list []string) string

func NoArticle

func NoArticle(name string) string

func SanitizeStrings

func SanitizeStrings(text ...string) string

func SanitizeText added in v0.47.0

func SanitizeText(text string) string

func TempFileName added in v0.52.0

func TempFileName(prefix, suffix string) string

func ToMillis

func ToMillis(t time.Time) int64

func ToTime

func ToTime(millis int64) time.Time

Types

type CachedHTTPClient added in v0.44.0

type CachedHTTPClient struct {
	// contains filtered or unexported fields
}

func NewCachedHTTPClient added in v0.44.0

func NewCachedHTTPClient(wrapped httpDoer, ttl time.Duration) *CachedHTTPClient

func (*CachedHTTPClient) Do added in v0.44.0

func (c *CachedHTTPClient) Do(req *http.Request) (*http.Response, error)

type IndexGroups

type IndexGroups map[string]string

func ParseIndexGroups

func ParseIndexGroups(spec string) IndexGroups

ParseIndexGroups The specification is a space-separated list of index entries. Normally, each entry is just a single character, but you may also specify multiple characters. For instance, the entry "The" will link to all files and folders starting with "The".

You may also create an entry using a group of index characters in parentheses. For instance, the entry "A-E(ABCDE)" will display as "A-E" and link to all files and folders starting with either A, B, C, D or E. This may be useful for grouping less-frequently used characters (such and X, Y and Z), or for grouping accented characters (such as A, \u00C0 and \u00C1)

Files and folders that are not covered by an index entry will be placed under the index entry "#".

type MergeFS added in v0.45.0

type MergeFS struct {
	Base    fs.FS
	Overlay fs.FS
}

MergeFS implements a simple merged fs.FS, that can combine a Base FS with an Overlay FS. The semantics are: - Files from the Overlay FS will override files with the same name in the Base FS - Directories are combined, with priority for the Overlay FS over the Base FS for files with matching names

func (MergeFS) Open added in v0.45.0

func (m MergeFS) Open(name string) (fs.File, error)

type WeightedChooser added in v0.47.0

type WeightedChooser struct {
	// contains filtered or unexported fields
}

func NewWeightedRandomChooser added in v0.44.0

func NewWeightedRandomChooser() *WeightedChooser

func (*WeightedChooser) Add added in v0.49.0

func (w *WeightedChooser) Add(value interface{}, weight int)

func (*WeightedChooser) GetAndRemove added in v0.47.0

func (w *WeightedChooser) GetAndRemove() (interface{}, error)

GetAndRemove choose a random entry based on their weights, and removes it from the list

func (*WeightedChooser) Remove added in v0.47.0

func (w *WeightedChooser) Remove(i int)

func (*WeightedChooser) Size added in v0.47.0

func (w *WeightedChooser) Size() int

Directories

Path Synopsis
Package gg implements simple "extensions" to Go language.
Package gg implements simple "extensions" to Go language.
Package pl implements some Data Pipeline helper functions.
Package pl implements some Data Pipeline helper functions.

Jump to

Keyboard shortcuts

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