golang的数字类型和mysql的整数类型

长话短说

如果是unsigned,就用unsigned来匹配。
如果不是unsigned,就用not unsigned来匹配。
为了避免不匹配的情况下发生溢出,我们要严密对待。
int是一种依赖。

MySQL 中的整数类型

请参考以下链接:
https://dev.mysql.com/doc/refman/5.7/zh-CN/numeric-type-overview.html

Golang的整数类型

请参阅以下链接:
http://golang.cn/go_spec#Numeric_types

粗略应对

mysqlgolangtiny intint8intint32big intint64

unsigned与unsigned之间相互对应。

bannerAds