utils

package
v0.0.0-...-ba2213e Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

README

工具库

方法
  • ParseConfig(cfg string, config interface{}) error 解析json文件到config结构体
  • MaptoStruct(data map[string]interface{}, result interface{}) error map转换对象
  • Get(requestURL string, params url.Values, body interface{}) error Get http请求中取数据
  • Post(requestURL string, params string, body interface{}) error Post http请求中取数据
  • RecoveredFn(cbs ...func()) panic回复方法,用于出现panic捕获。
  • UUID() string 返回标准uuid
  • CUID() string 返回去除-的uuid
  • ValidateStruct(obj interface{}) error 结构体验证
  • ValidateVar(field string, tag string) (bool, error) 变量验证

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CUID

func CUID() string

CUID return replace - char form uuid

func Get

func Get(requestURL string, params url.Values, body interface{}) error

Read http Get请求中取数据

func ParseConfig

func ParseConfig(cfg string, config interface{}) error

ParseConfig 解析json文件到config结构体

func Post

func Post(requestURL string, params string, body interface{}) error

Post http post请求中取数据

func RecoveredFn

func RecoveredFn(cbs ...func())

RecoveredFn panic recover func

func TimeMillisecondToHumanString

func TimeMillisecondToHumanString(t time.Time) string

func ToTrimString

func ToTrimString(filePath string) (content string, err error)

ToTrimString read file content from filepath and replace space

func UUID

func UUID() string

UUID return uuid string Author: jerrylou, <gunsluo@gmail.com> Since: 2017-03-24

func ValidateStruct

func ValidateStruct(obj interface{}) error

ValidateStruct 结构体验证

func ValidateVar

func ValidateVar(field string, tag string) (bool, error)

ValidateVar 变量验证

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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