Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

82:71: expected selector or type assertion, found ')' (and 5 more errors) #182

Closed
defp opened this issue Nov 4, 2020 · 1 comment
Closed

Comments

@defp
Copy link
Contributor

defp commented Nov 4, 2020

根据这个文档来的 https://www.yuque.com/tal-tech/go-zero/nkg20f

执行的时候报错

$ goctl model mysql datasource -url="root:root@tcp(127.0.0.1:3306)/blog" -table="posts" -dir ./model

82:71: expected selector or type assertion, found ')' (and 5 more errors)

根据db生成model代码

数据库是这样的

image

CREATE TABLE `posts` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) DEFAULT NULL,
  `content` text,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
@day112
Copy link

day112 commented Nov 5, 2020

这个表结构 id 已经是主键 。 把UNIQUE KEY id (id) 删除应该就可以了

@defp defp closed this as completed Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants