gadget

package module
v0.0.0-...-7619e40 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 13 Imported by: 2

README

gadget

Various utility functions for Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(num int) int

Abs returns the Abs of a Integer.

func Base64Decode

func Base64Decode(raw string) string

Base64Decode decodes base64 string.

func Base64Encode

func Base64Encode(raw string) string

Base64Encode encodes base64 string.

func HmacSha1

func HmacSha1(input string, key string) string

HmacSha1 HMAC SHA1 string.

func JSONEqual

func JSONEqual(j1, j2 []byte) bool

JSONEqual determines the two given JSON are equal or not. If the input is not JSON format, then make the input as string.

func MakeErrJSON

func MakeErrJSON(errCode int, msg string, a ...interface{}) (int, interface{})

MakeErrJSON makes the error response JSON for gin.

func MakeSuccessJSON

func MakeSuccessJSON(data interface{}) (int, interface{})

MakeSuccessJSON makes the successful response JSON for gin.

func Md5

func Md5(raw string) string

Md5 md5 string.

func Retry

func Retry(attempts int, f func() error) error

Retry will retry a function a specified number of times before giving up. The function retries on any error.

func Sha1

func Sha1(raw string) string

Sha1 sha1 string.

func URLDecode

func URLDecode(raw string) string

URLDecode decode URL string.

func URLEncode

func URLEncode(raw string) string

URLEncode encodes URL string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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