It has only to do with the act of correct observation, and by I mean a physical contact with all sorts of objects through all the senses

GO JSON 的序列化与反序列化

golang json marshal and unmarshal

在 Golang 中对于 json 的序列化和反序列化的控制大概有三种方式\n在默认的 JSON TAG 加上控制标签\n实现MarshalJSON() ([]byte, error)和UnmarshalJSON(b []byte) error 覆盖默认的 JSON 序列化和反序列化方法\n利用反射解析

Gorm 中 Scan 和 Find 的区别

the difference of Gorm scan and find

我们可以先看 Scan 和 Find 在 Gorm 中的接口定义\nFInd\n// gorm/finisher_api.go\n// Find find records that match given conditions\nfunc (db *DB) Find(dest interface{}, c

Gorm 改造指针对象

gorm object support pointer

最近项目中正好用到 Gorm 在使用 Gorm 的过程中发现在进行对象查询的时候不支持指针。具体的文档如下:\n如果我们强行使用指针进行查询代码如下:\nvar user *User\n// doesn't work\ndb.First(&user)\n\nGo\n会得到 \"invalid value\" 的错误\n

Golang Time Format 中的时区问题

golang time format zone bugs

t := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)\ns := t.Format(\"2006-01-02T15:04:05Z\")\nt1 := time.Date(2009, time.November, 10, 23, 0, 0