In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "structural instance Analysis of mysql generated by go xorm". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Many resources on the Internet say that it is xorm reverse mysql "root:123456@tcp (127.0.0.1 users?charset=utf8 3306) / users?charset=utf8".
Error report after execution: 15:00:53 on 2022-03-16 [Error] reverse.go:196 Unknown colType INT UNSIGNED
In fact, the original xorm can no longer be used, now it should be used like this:
Go get xorm.io/reverse
Then go to the bin directory under GOPATH
Vi custom.yml, which is used to configure information to connect to the database:
Kind: reversename: userssource: database: mysql conn_str: 'root:123456@tcp (127.0.0.1 userssource 3306) / users?parseTime=true'targets:- type: codes language: golang output_dir:. / testoutput
Execute:. / reverse-f custom.yml
Then go to the testoutput/ directory and generate the models.go file:
Package modelstype UserInfo struct {Id uint `xorm: "not null competes for autoincr comment ('ID') UNSIGNED INT" `Name string `xorm: "not null default' 'comment (' name') VARCHAR (50)" `Avatar string `xorm: "not null default''comment (' avatar') VARCHAR (255)" `Birthday string `xorm: "not null default 'comment (' date of birth') VARCHAR (50)" `Sex int `xorm: "not null default 0 comment ('gender: 0 unknown 1 male, 2 female') TINYINT (1) "`City string `xorm:" not null default''comment (' city') VARCHAR (50) "`Introduce string `xorm:" comment ('introduce') TEXT "`Status int `xorm:" not null default 0 comment ('status: 0 normal) 1 disable') TINYINT (1) "`CreateTime uint `xorm:" not null default 0 comment ('creation time') UNSIGNED INT "`UpdateTime uint `xorm:" not null default 0 comment ('last modified time') UNSIGNED INT "`DeleteTime uint `xorm:" not null default 0 comment ('delete time') UNSIGNED INT "`}
This is the end of the content of "structural instance Analysis of go xorm generating mysql". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.