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

fix bug: crash when generate model with goctl. #1777

Merged

Conversation

600ML
Copy link
Contributor

@600ML 600ML commented Apr 9, 2022

situation: column name with line.

CREATE TABLE test (
id int NOT NULL AUTO_INCREMENT,
zh-cn text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '中文简体',
PRIMARY KEY (id) USING BTREE,
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

situation: column name with line.

CREATE TABLE test (
id int NOT NULL AUTO_INCREMENT,
zh-cn text CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT '中文简体',
PRIMARY KEY (id) USING BTREE,
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
Copy link
Contributor Author

@600ML 600ML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

虽然这样改,影响面最小,但是还是觉得ReplaceAll("-", "_")写到stringx.ToCamel()里更方便
只是我今天刚接触这个框架,学习中,还是谨慎点

@kevwan kevwan requested a review from kesonan April 9, 2022 15:27
group imports
Use
go-zero/tools/goctl/util/string.go
 func SafeString(in string) string {
instead of ReplaceAll
@kevwan kevwan merged commit fabea4c into zeromicro:master Apr 11, 2022
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

Successfully merging this pull request may close these issues.

3 participants