utils

package
v1.0.0-beta.68 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileLogger = logger.HcLog().Named("raiden.utils.file")

Functions

func CleanDoubleColonPattern

func CleanDoubleColonPattern(input string) string

func CleanUpString

func CleanUpString(s string) string

func ConvertAllToString

func ConvertAllToString(value interface{}) string

func CopyFile

func CopyFile(sourcePath, targetPath string) error

func CreateFile

func CreateFile(fullPath string, deleteIfExist bool) (*os.File, error)

func CreateFolder

func CreateFolder(folder string) error

func DeleteFile

func DeleteFile(filePath string) error

func DeleteFolder

func DeleteFolder(folderPath string) error

func EmptyOrDefault added in v1.0.0

func EmptyOrDefault[T any](s T, def T, check ...ZeroChecker[T]) T

EmptyOrDefault returns def when s is considered "empty". Works whether T is a value or a pointer type.

func EmptyOrError added in v1.0.0

func EmptyOrError[T any](s T, message string, check ...ZeroChecker[T]) error

EmptyOrError returns an error when s is considered "empty". Works whether T is a value or a pointer type.

func GetAbsolutePath

func GetAbsolutePath(path string) (string, error)

func GetColoredHttpMethod

func GetColoredHttpMethod(httpMethod string) string

func GetCurrentDirectory

func GetCurrentDirectory() (string, error)

func HashByte

func HashByte(queryByte []byte) string

func HashString

func HashString(query string) string

func IsFileExists

func IsFileExists(filename string) bool

func IsFolderExists

func IsFolderExists(folderPath string) bool

func IsStringContainSpace

func IsStringContainSpace(input string) bool

func MatchReplacer

func MatchReplacer(query string, paramKey string, replacement string) string

func ParseBool

func ParseBool(str string) bool

func ParseTag

func ParseTag(rawTag string) map[string]string

func RemoveByIndex

func RemoveByIndex[T any](source []T, index []int) []T

Function to remove multiple elements by multiple index

func RemoveParenthesesContent

func RemoveParenthesesContent(input string) string

RemoveParenthesesContent removes content within parentheses from a string.

func SendRequest

func SendRequest(httpMethod string, url string, body []byte, reqInterceptor func(req *fasthttp.Request)) ([]byte, error)

func SnakeCaseToPascalCase

func SnakeCaseToPascalCase(s string) string

func ToCamelCase

func ToCamelCase(s string) string

func ToGoModuleName

func ToGoModuleName(s string) string

func ToKebabCase added in v1.0.0

func ToKebabCase(s string) string

func ToSnakeCase

func ToSnakeCase(s string) string

Types

type SendRequestError

type SendRequestError struct {
	Message string
	Body    []byte
}

func (SendRequestError) Error

func (s SendRequestError) Error() string

type ZeroChecker added in v1.0.0

type ZeroChecker[T any] func(T) bool

Optional: callers can override what "empty" means for T.

Jump to

Keyboard shortcuts

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