摘要: [TOC] # 时间[https://www.cnblogs.com/followyou/p/12187949.html](https://www.cnblogs.com/followyou/p/12187949.html) # error[https://www.cnblogs.com/followyou/p/12185514.html](https://www.cnblogs.com/foll... 阅读全文
posted @ 2020-01-13 16:34 walkingSun 阅读(507) 评论(0) 推荐(0) 编辑
摘要: [TOC] # 时间格式化```gonowTime := time.Now()fmt.Println(nowTime.Format("20060102")) //相当于Ymdfmt.Println(nowTime.Format("2006-01-02"))//相当于Y-m-dfmt.Println(nowTime.Format("2006-01-02 15:04:05"))//相当于Y-m-d H... 阅读全文
posted @ 2020-01-13 16:33 walkingSun 阅读(262) 评论(0) 推荐(0) 编辑
摘要: [TOC] # 返回error```goerrors.New("出现错误")```# error获取字符串```goerrors.error()```# 返回error(错误拼接)```go# 错误拼接fmt.Errorf("not found mongodb config: %s", "出现错误")```Errorf函数源码:```go// a参数是一个interface,可以接收任意类型fun... 阅读全文
posted @ 2020-01-13 05:35 walkingSun 阅读(363) 评论(0) 推荐(1) 编辑
摘要: [TOC] # 断言golang中的所有程序都实现了interface{}的接口,这意味着,所有的类型如string,int,int64甚至是自定义的struct类型都就此拥有了interface{}的接口,这种做法和java中的Object类型比较类似。那么在一个数据通过func funcName(interface{})的方式传进来的时候,也就意味着这个参数被自动的转为interface{}的... 阅读全文
posted @ 2020-01-13 04:35 walkingSun 阅读(1682) 评论(0) 推荐(0) 编辑
**/