utility

package
v0.0.0-...-823aa29 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackgroundColor  = "#2885D3"
	ContainerColor   = "#151718"
	ContainerWidth   = "700px"
	FontSize         = "18px"
	DefaultCssStyle  = "TomorrowNight-dark"
	DefaultFontStyle = "fontsFace"
)
View Source
const (
	MaxLocalCatchOfImg  = 50
	MaxCodeLength       = 2000
	MaxCodeLines        = 50
	MaxLocalCatchOfCode = 50
)

Variables

View Source
var CssStyle = map[string]string{
	"TomorrowNight-dark":   "TomorrowNight-dark",
	"Coy-light":            "Coy-light",
	"Default-light":        "Default-light",
	"Funky-dark":           "Funky-dark",
	"Okaidia-dark":         "Okaidia-dark",
	"SolarizedLight-light": "SolarizedLight-light",
	"Twilight-dark":        "Twilight-dark",
}
View Source
var GolangImg []byte

Functions

func BinPath

func BinPath() string

func Clamp

func Clamp(val, min, max int) int

func CloseFile

func CloseFile(mFile *os.File)

func CreateFile

func CreateFile(fileName string) (*os.File, error)

func CssStaticUrl

func CssStaticUrl() string

func FontsStaticUrl

func FontsStaticUrl() string

func GetGasUrl

func GetGasUrl() string

func GetStringFromURL

func GetStringFromURL(r *http.Request, key string, defaultVal string) string

func HashBySha256

func HashBySha256(val string) string

func Hostname

func Hostname() string

func IsFileOrDirExist

func IsFileOrDirExist(path string) bool

func OpenPngAsByte

func OpenPngAsByte(filePath string) ([]byte, error)

func PixelToInt

func PixelToInt(val string) int

func ResponseByJSON

func ResponseByJSON(w http.ResponseWriter, statusCode int, message string)

func ResponseByPage

func ResponseByPage(w http.ResponseWriter, r *http.Request, statusCode int, message string)

func ResponseByQRCode

func ResponseByQRCode(w http.ResponseWriter, statusCode int, message string)

func SaveBytesAsPng

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

Types

type ResponseMethod

type ResponseMethod int
const (
	Json   ResponseMethod = 0
	QRCode ResponseMethod = 1
	Page   ResponseMethod = 2
)

Jump to

Keyboard shortcuts

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