2018年11月28日

表字段对应值输出

摘要: ``` package main import ( "database/sql" "fmt" "log" _ "github.com/go sql driver/mysql" ) //先把字段的值都当成字符串 func Rows2SliceMap(rows sql.Rows) (list []map 阅读全文

posted @ 2018-11-28 11:24 Ryanyanglibin 阅读(98) 评论(0) 推荐(0) 编辑

将struct转为map

摘要: ``` package main import ( "fmt" "reflect" "time" ) type User struct { Id int64 Username string Password string Logintime time.Time } func Struct2Map(o 阅读全文

posted @ 2018-11-28 11:22 Ryanyanglibin 阅读(218) 评论(0) 推荐(0) 编辑

导航