utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: AGPL-3.0 Imports: 18 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 CheckPort

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

func CreateFile

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

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 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 GetJson

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

func IsWinPlatform

func IsWinPlatform() bool

func SendResponse

func SendResponse(c *gin.Context, data any)

SendResponse Try to return data

func Unzip

func Unzip(src string, dest string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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