doraemon

package module
v0.0.0-...-f6c0e8d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: AGPL-3.0 Imports: 14 Imported by: 1

README

Doraemon

介绍

Doraemon是常用的一些操作的集合工具,包括的功能有 1、类型转换 2、时间戳转换 3、网络请求

安装教程
go get gitee.com/countpoison/Doraemon
使用说明
import (
	d "gitee.com/countpoison/Doraemon"
)
参考

代码用到了 github.com/astaxie/beego/httplib (beego的网络请求插件) https://github.com/Unknwon/goconfig (常用的config解析插件)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error)

错误检查,直接panic

func CmdRun

func CmdRun(cmdline string, w bool) (string, error)

执行命令,并等待结果,w参数控制是否返回结果

func CompressZip

func CompressZip(list []string, zipname string) error

func Md5sum

func Md5sum(file string) string

文件md5检查

func Sleep

func Sleep(val int)

time.sleep的简化写法,毫秒为单位

func TimeFormat

func TimeFormat(val interface{}) (string, error)

将表现为11或13位数字的字符串的任意类型数据,转化为一个"2006-01-02 15:04:05"时间格式化的字符串

func TimeFormatTo

func TimeFormatTo(val interface{}, timestr string) (string, error)

将表现为11或13位数字的字符串的任意类型数据,转化为一个时间格式化的字符串

func ToByte

func ToByte(a interface{}) ([]byte, error)

转[]byte

func ToFloat32

func ToFloat32(a interface{}) (float32, error)

转floate32

func ToFloat32Round

func ToFloat32Round(a interface{}, rd int) (float32, error)

转floate32,rd保留小数点后几位

func ToFloat64

func ToFloat64(a interface{}) (float64, error)

转floate64

func ToFloat64Round

func ToFloat64Round(a interface{}, rd int) (float64, error)

转floate64,rd保留小数点后几位

func ToInt64Ceil

func ToInt64Ceil(a interface{}) (int64, error)

转int64,向上取整

func ToInt64Floor

func ToInt64Floor(a interface{}) (int64, error)

转int64,向下取整

func ToInt64Round

func ToInt64Round(a interface{}) (int64, error)

转int64,四舍五入取整

func ToIntCeil

func ToIntCeil(a interface{}) (int, error)

转int,向上取整

func ToIntFloor

func ToIntFloor(a interface{}) (int, error)

转int,向下取整

func ToIntRound

func ToIntRound(a interface{}) (int, error)

转int,四舍五入取整

func ToString

func ToString(a interface{}) (string, error)

转string

Types

This section is empty.

Directories

Path Synopsis
Package goconfig is a fully functional and comments-support configuration file(.ini) parser.
Package goconfig is a fully functional and comments-support configuration file(.ini) parser.
Package httplib is used as http.Client Usage: import "github.com/astaxie/beego/httplib" b := httplib.Post("http://beego.me/") b.Param("username","astaxie") b.Param("password","123456") b.PostFile("uploadfile1", "httplib.pdf") b.PostFile("uploadfile2", "httplib.txt") str, err := b.String() if err != nil { t.Fatal(err) } fmt.Println(str) more docs http://beego.me/docs/module/httplib.md
Package httplib is used as http.Client Usage: import "github.com/astaxie/beego/httplib" b := httplib.Post("http://beego.me/") b.Param("username","astaxie") b.Param("password","123456") b.PostFile("uploadfile1", "httplib.pdf") b.PostFile("uploadfile2", "httplib.txt") str, err := b.String() if err != nil { t.Fatal(err) } fmt.Println(str) more docs http://beego.me/docs/module/httplib.md

Jump to

Keyboard shortcuts

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