util

package
v0.0.0-...-b124a9c Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileMD5

func FileMD5(file *os.File) string

func FileSha1

func FileSha1(file *os.File) string

func GenSimpleRespStream

func GenSimpleRespStream(code int, msg string) []byte

GenSimpleRespStream : 只包含code和message的响应体([]byte)

func GenSimpleRespString

func GenSimpleRespString(code int, msg string) string

GenSimpleRespString : 只包含code和message的响应体(string)

func GetFileSize

func GetFileSize(filename string) int64

func MD5

func MD5(data []byte) string

func PathExists

func PathExists(path string) (bool, error)

func Sha1

func Sha1(data []byte) string

Types

type RespMsg

type RespMsg struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

RespMsg : http响应数据的通用结构

func NewRespMsg

func NewRespMsg(code int, msg string, data interface{}) *RespMsg

NewRespMsg : 生成response对象

func (*RespMsg) JSONBytes

func (resp *RespMsg) JSONBytes() []byte

JSONBytes : 对象转json格式的二进制数组

func (*RespMsg) JSONString

func (resp *RespMsg) JSONString() string

JSONString : 对象转json格式的string

type Sha1Stream

type Sha1Stream struct {
	// contains filtered or unexported fields
}

func (*Sha1Stream) Sum

func (obj *Sha1Stream) Sum() string

func (*Sha1Stream) Update

func (obj *Sha1Stream) Update(data []byte)

Jump to

Keyboard shortcuts

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