![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Go
ZhongQi0808
菜鸟码农
展开
-
Golang HTML的文件上传 ,读取写入文件
func CopyFileDataSource(c *m.ReqContext, cmd m.FileDataSourceCommand) Response { for _, v := range c.Req.MultipartForm.File { for _, j := range v { if strings.HasSuffix(j.Filename, ".csv") { ...原创 2018-05-14 16:34:57 · 2859 阅读 · 0 评论 -
go 按行读取自定义文件
自定义配置文件如下: file,_ := os.Open("path") fileScanner := bufio.NewScanner(file) for fileScanner.Scan() { // 以#开头视为注释 空行和注释不读取 if strings.HasPrefix(fileScanner.Text(),"#") || fileScanner.Text() ...原创 2019-03-05 20:06:54 · 1235 阅读 · 0 评论 -
go net/http 发送http请求
发送请求,通过内置http服务, 对象转换json //定义结构体 type AuthVar struct { Expirems string } //strconv.FormatInt(expirems,10) 可以将int64转换为string a := AuthVar{Expirems: strconv.FormatInt(expirems,10)} b := new(b...原创 2019-03-05 20:22:39 · 2106 阅读 · 0 评论 -
go 日期时间转换 常用数据转换
base64解加密,bytes数组转string ,日期转换 //installtime 是一个经过encode和base64编码后的数据 (即特定加密过后数据)时间戳 //解码 date,_ := base64.StdEncoding.DecodeString(string(installtime)) //将byte数组转换为字符串 str := string(date[:]) /...原创 2019-03-05 20:43:08 · 2566 阅读 · 0 评论