util

package
v0.0.0-...-bcb1c7f Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertImageToJpg

func ConvertImageToJpg(img []byte) ([]byte, error)

func CopyMap

func CopyMap[T comparable, E any](source map[T]E) map[T]E

func CreateCancelContext

func CreateCancelContext() (context.Context, context.CancelFunc)

func CreateTimeoutContext

func CreateTimeoutContext(timeout time.Duration) (context.Context, context.CancelFunc)

func FindFirst

func FindFirst[T any](arr []T, function func(value T) bool) (T, bool)

func FormatCookieString

func FormatCookieString(cookies map[string]string) string

func GenerateSecMSGec

func GenerateSecMSGec() string

func GracefulPanic

func GracefulPanic(err error)

func LoadEnv

func LoadEnv(filePath string) error

func MakeHTTPClient

func MakeHTTPClient(proxy string, timeout time.Duration) (*http.Client, *req.Client, error)

func Map

func Map[T any, E any](arr []T, function func(value T) E) []E

func MustGenerateRandomHex

func MustGenerateRandomHex(length int) string

func OpenURL

func OpenURL(url string) error

func ParseCookies

func ParseCookies(cookiesStr string) map[string]string

func ParseCookiesFromString

func ParseCookiesFromString(cookiesStr string) map[string]string

func RandIntInclusive

func RandIntInclusive(min int, max int) int

func ReadCookiesFile

func ReadCookiesFile() (map[string]string, error)

func ReadDebugOptionSets

func ReadDebugOptionSets() (debugOptionsSets []string)

func Ternary

func Ternary[T any](expression bool, trueResult T, falseResult T) T

func UpdateCookiesFile

func UpdateCookiesFile(cookies map[string]string) error

func WithPath

func WithPath(filename string) string

Types

type FileCookie

type FileCookie struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

func ReadCookiesFileRaw

func ReadCookiesFileRaw() ([]FileCookie, error)

type LazyExpiryKVStore

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

func NewLazyExpiryStore

func NewLazyExpiryStore() *LazyExpiryKVStore

func (*LazyExpiryKVStore) Delete

func (kv *LazyExpiryKVStore) Delete(key string)

func (*LazyExpiryKVStore) Get

func (kv *LazyExpiryKVStore) Get(key string) (any, bool)

func (*LazyExpiryKVStore) Set

func (kv *LazyExpiryKVStore) Set(key string, value any, expiryInSeconds int)

Jump to

Keyboard shortcuts

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