上一页 1 ··· 108 109 110 111 112 113 114 115 116 ··· 234 下一页

2019年9月6日

接口文档神器之apidoc

摘要: //@desn:apidoc linux环境 windows环境使用 //@desn:码字不宜,转载请注明出处 //@author:张慧源 <turing_zhy@163.com> //@date:2018/5/6 正文: windows版安装: 1.安装nodejs (nodejs环境) 32 位 阅读全文

posted @ 2019-09-06 16:45 ExplorerMan 阅读(332) 评论(0) 推荐(0)

2019年9月5日

Golang 数组和切片

摘要: 数组 数组是类型相同的元素的集合。例如,整数 5, 8, 9, 79, 76 的集合就构成了一个数组。Go不允许在数组中混合使用不同类型的元素(比如整数和字符串)。 声明 有很多声明数组的方式,让我们一个一个地介绍。 var a [3]int 声明了一个长度为 3 的整型数组。数组中的所有元素都被自 阅读全文

posted @ 2019-09-05 18:19 ExplorerMan 阅读(303) 评论(0) 推荐(0)

go切片展开

摘要: 可以使用 ... 操作符将一个切片追加到另一个切片末尾: 上面的程序中,在第10行将 fruits 追加到 veggies 并赋值给 food。...操作符用来展开切片。程序的输出为:food: [potatoes tomatoes brinjal oranges apples]。 阅读全文

posted @ 2019-09-05 18:17 ExplorerMan 阅读(2067) 评论(0) 推荐(0)

2019年9月4日

Go的json解析:Marshal与Unmarshal

摘要: 简介Json(Javascript Object Nanotation)是一种数据交换格式,常用于前后端数据传输。任意一端将数据转换成json 字符串,另一端再将该字符串解析成相应的数据结构,如string类型,strcut对象等。 go语言本身为我们提供了json的工具包”encoding/jso 阅读全文

posted @ 2019-09-04 19:42 ExplorerMan 阅读(550) 评论(0) 推荐(0)

golang depth read map

摘要: Foreword: I optimized and improved the below solution, and released it as a library here: github.com/icza/dyno. The cleanest way would be to create pr 阅读全文

posted @ 2019-09-04 19:32 ExplorerMan 阅读(410) 评论(0) 推荐(0)

golang 多级json转map

摘要: func main() { jsonStr := `{"isSchemaConforming":true,"schemaVersion":0,"unknown.0":[{"email_address":"test1@uber.com"},{"email_address":"test2@uber.com"}]}` dynamic := make(map[string]interf... 阅读全文

posted @ 2019-09-04 19:14 ExplorerMan 阅读(3312) 评论(0) 推荐(0)

GoLang中 json、map、struct 之间的相互转化

摘要: 1. golang 中 json 转 struct <1. 使用 json.Unmarshal 时,结构体的每一项必须是导出项(import field)。也就是说结构体的 key 对应的首字母必须为大写。请看下面的例子: 输出的结果如下: 1 { 0} 1 { 0} 1 { 0} 1 { 0} { 阅读全文

posted @ 2019-09-04 19:06 ExplorerMan 阅读(687) 评论(0) 推荐(0)

利用delve(dlv)在Visual Code中进行go程序的远程调试-debug方式

摘要: 最近碰到一个问题,如何在Windows的IDE或者文本编辑器上,远程调试Linux服务器上的golang程序。 虽然想说gdb走你,但既然go有dlv这样的类似Java的jdwp的原生方案,而且我用的Visual Code的官方Go插件支持这种方案,那就试一下这个方案吧。 2019-03-15追加: 阅读全文

posted @ 2019-09-04 17:46 ExplorerMan 阅读(1225) 评论(0) 推荐(0)

golang数据类型转换

摘要: int--string 1 2 3 4 //string到int value_int,err:=strconv.Atoi(string) //int到string str:=strconv.Itoa(value_int) 1 2 3 4 //string到int value_int,err:=str 阅读全文

posted @ 2019-09-04 16:00 ExplorerMan 阅读(165) 评论(0) 推荐(0)

golang 数据类型之间的转换

摘要: 一、基本数据类型之间的转换 1、string到int int,err:=strconv.Atoi(string) 2、string到int64 int64, err := strconv.ParseInt(string, 10, 64) 3、int到string string:=strconv.It 阅读全文

posted @ 2019-09-04 15:57 ExplorerMan 阅读(900) 评论(0) 推荐(0)

上一页 1 ··· 108 109 110 111 112 113 114 115 116 ··· 234 下一页

导航