utils

package
v0.0.0-...-d2ae02e Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StructStringMaxDefault = 1024000
)

Variables

View Source
var (
	ErrUuidType  error = errors.New("UUID type error")
	ErrStringMax error = errors.New("String length out of defined")
	ErrStringMin error = errors.New("String length lite than defined")
)

Functions

func GenUuid

func GenUuid() string

统一产生全站的uuid

func ImageToiMutiFile

func ImageToiMutiFile(img image.Image, t string) (f multipart.File, hash string, err error)

图片对象转文件对象 返回multipart.File类型和sha1值

func MD5

func MD5(s string) (hash string)

md5 sum of string

func MergeStruct

func MergeStruct(dst, src interface{}) error

合并struct todo: 检查不允许合并的项

func MultipartFileHash

func MultipartFileHash(file multipart.File) (hash string, err error)

multipart文件hash

func Pinyin

func Pinyin(s string) (ret string)

func ScryptString

func ScryptString(s string, salt string) (dk []byte, err error)

scrypt string to key bit arrary

func StrcutValid

func StrcutValid(v interface{}) (err error)

合法性检测

func UpdateStruct

func UpdateStruct(input interface{}, source interface{}) (err error)

update structure whith map

func UuidValid

func UuidValid(s string) bool

判断uuid是否合法

Types

type Reader

type Reader struct {
	Path string // 文件路径

	EOF error
	// contains filtered or unexported fields
}

func NewReader

func NewReader(path string) (*Reader, error)

func (*Reader) Close

func (reader *Reader) Close() (err error)

关闭文件

func (*Reader) Open

func (reader *Reader) Open() (err error)

打开文件

func (*Reader) ReadOneline

func (reader *Reader) ReadOneline() (line string, err error)

读行,每次返回完整的一行

Jump to

Keyboard shortcuts

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