Golang操作mysql建表的问题

zykzhang · · 5659 次点击
确实冗余,我改了之后的错误信息: ```go DROP TABLE IF EXISTS bac; CREATE TABLE bac( uid INT(10) NOT NULL AUTO_INCREMENT, username VARCHAR(64) DEFAULT NULL, departname VARCHAR(64) DEFAULT NULL, created DATE DEFAULT NULL, PRIMARY KEY(uid) )ENGINE=InnoDB DEFAULT CHARSET=utf8; panic: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE bac( uid INT(10) NOT NULL AUTO_INCREMENT, username VARCHAR(64) DE' at line 2 ```
#9
更多评论
panic 是 checkErr(err) 打出来的?
#1
是的 ```go func checkErr(err error) { if err != nil { panic(err) } } ```
#2