utils

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(source, destination string) error

func DeleteFile

func DeleteFile(path string) error

DELETE FILE

func Difference added in v0.7.0

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

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

Generate Random Bytes

func GenerateRandomString

func GenerateRandomString(s int) string

Generate Random String

func GenerateUUID

func GenerateUUID() (string, error)

UUID

func GetIpCountry

func GetIpCountry(ip string) string

func GetPrivateIp added in v1.0.3

func GetPrivateIp() string

Private Ip

func GracefulShutdown

func GracefulShutdown(f func() error) error

Graceful Shutdown

func IsLower added in v0.7.1

func IsLower(s string) bool

func IsSameSlice

func IsSameSlice[A []T, B []T, T comparable](x []T, y []T) bool

IsSameSlice check if both slice are equal

func IsUpper added in v0.7.1

func IsUpper(s string) bool

func OpenBrowser

func OpenBrowser(url string)

func ParseMultipartForm added in v0.5.0

func ParseMultipartForm(r *http.Request, size ...int64) (formData url.Values, formFiles map[string][]*multipart.FileHeader)

Parse body multipart

func PathExists

func PathExists(path string) bool

Check if file exists

func PrintMemUsage

func PrintMemUsage()

MemUsage

func RetryEvery

func RetryEvery(t time.Duration, function func() error, maxRetry ...int)

func ReverseSlice

func ReverseSlice[S ~[]E, E any](s S)

ReverseSlice

func RunEvery

func RunEvery(t time.Duration, function any)

Cronjob like

func SendEmail

func SendEmail(to_email string, subject string, textToSend string)

Send Email

func ShuffleCharacters

func ShuffleCharacters(text string) string

func SliceContains

func SliceContains[T comparable](elems []T, vs ...T) bool

func SliceRemove added in v1.0.55

func SliceRemove[T comparable](slice *[]T, elemsToRemove ...T)

func SnakeCaseToTitle added in v1.0.3

func SnakeCaseToTitle(inputUnderScoreStr string) (camelCase string)

func StringContains

func StringContains(s string, subs ...string) bool

func ToSlug added in v0.9.9

func ToSlug(s string) (string, error)

func ToSnakeCase added in v1.0.3

func ToSnakeCase(str string) string

func UploadFile

func UploadFile(received_filename, folder_out string, r *http.Request, acceptedFormats ...string) (string, []byte, error)

func UploadFileBytes added in v0.5.0

func UploadFileBytes(fileData []byte, filename string, outPath string, acceptedFormats ...string) (string, error)

UPLOAD FILE

func UploadFiles added in v0.5.0

func UploadFiles(received_filenames []string, folder_out string, r *http.Request, acceptedFormats ...string) ([]string, [][]byte, error)

func UploadMultipartFile added in v0.5.0

func UploadMultipartFile(file multipart.File, filename string, outPath string, acceptedFormats ...string) (string, error)

UPLOAD Multipart FILE

Types

type ContextKey

type ContextKey string

Directories

Path Synopsis
Package acme provides an implementation of the Automatic Certificate Management Environment (ACME) spec, most famously used by Let's Encrypt.
Package acme provides an implementation of the Automatic Certificate Management Environment (ACME) spec, most famously used by Let's Encrypt.
autocert
Package autocert provides automatic access to certificates from Let's Encrypt and any other ACME-based CA.
Package autocert provides automatic access to certificates from Let's Encrypt and any other ACME-based CA.
encryption
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.

Jump to

Keyboard shortcuts

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