utils

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadResponse

func BadResponse(c *gin.Context, err error)

BadResponse Return error status code and error message

func BuildURLParams

func BuildURLParams(baseURL string, params map[string]string) (string, error)

func BuildWSBadResponse added in v0.1.0

func BuildWSBadResponse(status string, echo string) global.MsgData

func BuildWSGoodResponse added in v0.1.0

func BuildWSGoodResponse(status string, echo string, entry ...any) global.MsgData

func BuildWSResponse added in v0.1.0

func BuildWSResponse(status string, retcode int32, echo string, entry ...any) global.MsgData

func CheckPort

func CheckPort(host string, port int, timeout time.Duration) error

func ContainsArgs added in v0.2.0

func ContainsArgs(flag string) bool

func CreateFile

func CreateFile(filePath string, data []byte) error

func DecryptAES added in v0.0.2

func DecryptAES(key []byte, ct string) string

func DownloadFile

func DownloadFile(url string, filePath string) error

func DownloadFileWithHeaders

func DownloadFileWithHeaders(url string, filePath string, headers map[string]string, fileSize int64) error

func EncryptAES added in v0.0.2

func EncryptAES(key []byte, plaintext string) string

func FileExists

func FileExists(filename string) bool

func Format

func Format(s string, args ...interface{}) string

Format {index} to args

func GetDefault

func GetDefault(data any, def string) string

GetDefault allows the data param to be nil

func GetForwardImpl added in v0.2.0

func GetForwardImpl() (*model.Implementation, error)

GetForwardImpl get first forwardImpl from appsettings.json

func GetJson

func GetJson(url string, headers map[string]string, v any) error

func GoodResponse added in v0.1.0

func GoodResponse(c *gin.Context, entry ...any)

GoodResponse Try to return data entry: mapKey1, mapValue1 ...

func GoodResponseArray added in v0.1.0

func GoodResponseArray(c *gin.Context, array any)

func IsWinPlatform

func IsWinPlatform() bool

func PKCS7Padding added in v0.0.2

func PKCS7Padding(data []byte, blockSize int) []byte

func PKCS7Unpadding added in v0.0.2

func PKCS7Unpadding(data []byte) []byte

func RandomAvailablePort added in v0.1.0

func RandomAvailablePort(rangePort bool, start int, end int) (int, error)

func ReturnsNonNull added in v0.1.0

func ReturnsNonNull(data interface{}) string

func RunExec added in v0.1.0

func RunExec(mx *sync.Mutex) error

func Unzip

func Unzip(src string, dest string) error

func WaitCondition added in v0.2.0

func WaitCondition(gap time.Duration, condition func() error, waitCallback func(error)) <-chan struct{}

func WaitNTQQStartup added in v0.2.0

func WaitNTQQStartup(host string, port int, waitCallback func(error)) <-chan struct{}

WaitNTQQStartup wait the NTQQ startup

Types

This section is empty.

Jump to

Keyboard shortcuts

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