utils

package
v0.0.0-...-3446103 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DATE_FORMAT = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func AllowCORS

func AllowCORS(h http.Handler) http.Handler

allowCORS allows Cross Origin Resoruce Sharing from any origin. Don't do this without consideration in production systems.

func CatchError

func CatchError(detail string, err error)

func CreateDir

func CreateDir(dirs ...string) (err error)

func FirstDayOfLastMonth

func FirstDayOfLastMonth() string

获取上个月第一天 return "2006-01-02 00:00:00"

func GrpcHandlerFunc

func GrpcHandlerFunc(grpcServer *grpc.Server, otherHandler http.Handler) http.Handler

用于判断请求是来源于Rpc客户端还是Restful Api的请求, 根据不同的请求注册不同的ServeHTTP服务;r.ProtoMajor == 2也代表着请求必须基于HTTP/2

func IsChinese

func IsChinese(str string) []int

中文index

func IsGBK

func IsGBK(data []byte) bool

func LastDayOfLastMonth

func LastDayOfLastMonth() string

上月最后一天

func ParseTime

func ParseTime(datestr string) (time.Time, error)

解析时间

func PathExists

func PathExists(path string) (bool, error)

func Random

func Random() string

func ReaderText

func ReaderText(readerfile string) (string, error)

func WirteText

func WirteText(savefile string, txt string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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