GORM

GORM 标签下共有 1 篇文章

MySQL + GORM 如何设置创建时间和更新时间

• bwangel Golang GORM MySQL Blog

目标

正确配置 MySQL 表中的 create_time 和 update_time,自动记录行的创建时间和更新时间,精度为微秒

如何正确配置 create_time 和 update_time (How)

一、MySQL DDL

建表时将 create_time、update_time 设为微秒精度:

CREATE TABLE `item` (
  `id` int NOT NULL …