utils

package
v0.0.0-...-08a38b7 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgBadArgument    = "Bad Argument"
	MsgBadToken       = "Bad Token"
	MsgGeneralFailure = "Server Failure"
	MsgSuccess        = "Success"
	MsgBadLogin       = "Bad username or password"
)

Variables

This section is empty.

Functions

func EncodeURIComponent

func EncodeURIComponent(str string) string

EncodeURIComponent

via https://blog.csdn.net/zengming00/article/details/81977362

func FatalError

func FatalError(err error)

func GenerateRandomBytes

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

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GetEditKey

func GetEditKey() string

Types

type Response

type Response struct {
	Success bool        `json:"success"`
	Message string      `json:"message"`
	Content interface{} `json:"content"`
}

func FailureRes

func FailureRes(msg string) Response

func SuccessRes

func SuccessRes(content interface{}) Response

Jump to

Keyboard shortcuts

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