utils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(str string, args ...interface{})

Error to print error.

func Fatal

func Fatal(str string, args ...interface{})

Fatal to log fatal.

func GetKey

func GetKey(params ...interface{}) string

GetKey to generate cache key.

func GetLogger

func GetLogger() log.Logger

GetLogger to get logger.

func ImageURLCleaner

func ImageURLCleaner(str string) string

ImageURLCleaner to clean mal image cover url.

func Info

func Info(str string, args ...interface{})

Info to log info.

func InitLog

func InitLog(t log.LogType, lvl log.LogLevel, json, color bool) (err error)

InitLog to init global logger.

func Log

func Log(field map[string]interface{})

Log to log with custom field.

func Recoverer

func Recoverer(next http.Handler) http.Handler

Recoverer is custom recoverer middleware. Will return 500.

func RespondWithCSS

func RespondWithCSS(w http.ResponseWriter, statusCode int, data string, err error)

RespondWithCSS to write response with CSS format.

func Validate

func Validate(data interface{}) error

Validate to validate struct using validate tag. Use pointer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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