utils

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHash

func CheckHash(input, hash string) error

func CreateTestDir

func CreateTestDir(prefix string) string

CreateTestDir creates a temporary directory for testing

func ExtractContent

func ExtractContent(content string) (string, string)

func FirstError

func FirstError(errors ...error) error

FirstError return the first error in a list of errors

func GenerateHash

func GenerateHash(input string) (string, error)

func GetFunctionName

func GetFunctionName(i interface{}) string

func GetRootDir

func GetRootDir() string

GetRootDir return the root directory of the project

func GetStructField

func GetStructField(entity interface{}, field string) reflect.Value

GetStructField returns the value of a struct field

func MarkdownToHtml

func MarkdownToHtml(content string) (string, error)

func RandomString

func RandomString(n int) string

func RecoverTestPanic

func RecoverTestPanic(t *testing.T, expected string, msgs ...string)

func Repeat

func Repeat[T comparable](input T, time int) []T

func SanitizeMarkdown

func SanitizeMarkdown(html string) string

func SanitizePlainText

func SanitizePlainText(html string) string

func SliceAppendIfNotExists

func SliceAppendIfNotExists[T comparable](slice []T, newItem T, checkExists func(T) bool) []T

func SliceContains

func SliceContains[T comparable](slice []T, element T) bool

func SliceFilter

func SliceFilter[T comparable](slice []T, predicate func(T) bool) []T

func SliceMap

func SliceMap[T comparable, R comparable](slice []T, mapper func(T) R) []R

func SliceOverlap

func SliceOverlap[T comparable](slice1 []T, slice2 []T) []T

Types

type HashConfig

type HashConfig struct {
	Iterations uint32
	Memory     uint32
	KeyLen     uint32
	Threads    uint8
}

Jump to

Keyboard shortcuts

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