utility

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	CustomDefaultLogFunc LogFunc
}

func NewInstance

func NewInstance() *Instance

func (*Instance) Checksum

func (this *Instance) Checksum(data []byte) uint32

func (*Instance) DefaultLogFunc

func (this *Instance) DefaultLogFunc(ctx context.Context, format string, data ...interface{})

func (*Instance) DiscardLogFunc

func (this *Instance) DiscardLogFunc(ctx context.Context, format string, data ...interface{})

func (*Instance) GetCachedFile

func (this *Instance) GetCachedFile(filePath string) (file *os.File, err error)

func (*Instance) GetClientIP

func (this *Instance) GetClientIP(req *http.Request) string

func (*Instance) GetServerAddress

func (this *Instance) GetServerAddress() (ip string, err error)

func (*Instance) InArrayString

func (this *Instance) InArrayString(needle string, haystack []string, caseSensitives ...bool) bool

inArray 判断字符串是否存在数组中

func (*Instance) InMapString

func (this *Instance) InMapString(needle string, haystack map[string]string) bool

func (*Instance) Initiate

func (this *Instance) Initiate(ctx context.Context) (context.Context, error)

func (*Instance) Md5Byte

func (this *Instance) Md5Byte(text []byte) string

获取给定byte的MD5

func (*Instance) Md5File

func (this *Instance) Md5File(f *os.File) (string, error)

func (*Instance) NewFile

func (this *Instance) NewFile(filePath string, perm os.FileMode, payload io.Reader, sizes ...int64) (file *os.File, err error)

func (*Instance) NewTemporaryFile

func (this *Instance) NewTemporaryFile(temporaryPath string, prefix string, payload io.Reader, sizes ...int64) (file *os.File, fileSize int64, err error)

func (*Instance) OnRequestShutdown

func (this *Instance) OnRequestShutdown(c *routing.Context) error

func (*Instance) OnRequestStartup

func (this *Instance) OnRequestStartup(c *routing.Context) error

func (*Instance) OnShutdown

func (this *Instance) OnShutdown(ctx context.Context) (context.Context, error)

func (*Instance) OnStartup

func (this *Instance) OnStartup(ctx context.Context) (context.Context, error)

func (*Instance) SetDefaultLogFunc

func (this *Instance) SetDefaultLogFunc(defaultLogFunc LogFunc)

func (*Instance) WildcardMatch

func (this *Instance) WildcardMatch(pattern, subject string) bool

type LogFunc

type LogFunc func(ctx context.Context, format string, data ...interface{})

LogFunc logs a message using the given format and optional arguments. The usage of format and arguments is similar to that for fmt.Printf(). LogFunc should be thread safe.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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