LoginSignup
2
1

More than 3 years have passed since last update.

golangの数値型とmysqlの整数型

Posted at

TL;DR

unsignedだったらunsignedで合わせる。
not unsignedだったらnot unsignedで合わせる。
アンマッチの場合はきっちりオーバーフローするので回避したい。
intは甘え。

mysqlの整数型

リンク先参照
https://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html

golangの整数型

リンク先参照
http://golang.jp/go_spec#Numeric_types

ざっくり対応

mysql golang
tiny int int8
int int32
big int int64

unsignedはunsigned同士で対応。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1