helper

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToFile

func AppendToFile(filePath string, content string) error

AppendToFile appends the given content to the end of the specified file

func BcryptCheck

func BcryptCheck(password, hash string) bool

BcryptCheck Compare the plaintext password with the database hash.

func BcryptHash

func BcryptHash(password string) (pw string, err error)

BcryptHash Encrypt passwords using bcrypt.

func CamelCase

func CamelCase(input string) string

func Capitalize

func Capitalize(s string) string

Capitalize Capital case

func Contains

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

func CreateDirIfNotExist

func CreateDirIfNotExist(path string) (err error)

CreateDirIfNotExist Create dir if not existed.

func Empty

func Empty(val interface{}) bool

Empty Whether the detection value exists.

func GetFileContent

func GetFileContent(filePath string) (content string, err error)

GetFileContent get file content return string.

func GetFirstRuneLower

func GetFirstRuneLower(s string) string

GetFirstRuneLower returns the first rune of a string in lowercase as a string

func GetModule

func GetModule(pwd, format string) (result string)

func InsertImport

func InsertImport(filePath, newImport, format, t string) error

InsertImport 插入新的import路径到指定的Go文件中

func InsertStringInFile added in v1.1.0

func InsertStringInFile(filePath, contentToFind, stringToInsert string) error

InsertStringInFile inserts a string into a file after a specified content.

func MicrosecondsStr

func MicrosecondsStr(elapsed time.Duration) string

MicrosecondsStr Converts time to a string of milliseconds.

func PathExists

func PathExists(path string) bool

PathExists checks if the specified path (file or directory) exists and returns a boolean value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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