{"id":21288510,"url":"https://github.com/wonli/gormt","last_synced_at":"2025-09-01T07:37:37.136Z","repository":{"id":239542996,"uuid":"799793266","full_name":"wonli/gormt","owner":"wonli","description":"golang database to struct","archived":false,"fork":false,"pushed_at":"2024-05-17T09:50:25.000Z","size":37,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-28T20:49:36.909Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wonli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-13T05:43:40.000Z","updated_at":"2024-05-17T09:50:28.000Z","dependencies_parsed_at":"2024-05-13T08:27:28.041Z","dependency_job_id":"b8553ba8-3efb-4fbb-8ecf-4611c3a3bb21","html_url":"https://github.com/wonli/gormt","commit_stats":null,"previous_names":["wonli/gormt"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wonli/gormt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fgormt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fgormt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fgormt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fgormt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wonli","download_url":"https://codeload.github.com/wonli/gormt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonli%2Fgormt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273089235,"owners_count":25043688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T12:22:12.509Z","updated_at":"2025-09-01T07:37:37.107Z","avatar_url":"https://github.com/wonli.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Golang Database to Struct\n\n### MySQL Database to Golang Struct Conversion Tool Based on GORM v2\n\nThis tool allows you to automatically generate Golang structs from a MySQL database using GORM (version 2). It supports the big Camel-Case naming convention and JSON tags.\n\n### Improvements\n\nThis project is derived and improved from `https://github.com/xxjwxc/gormt`. Changes include:\n- Removal of the GUI for a simpler command-line interface.\n- Addition of table prefix configuration options.\n- Added support for `GEOMETRY` data type.\n- Removal of some unnecessary code for a more streamlined experience.\n\n## Support for GORM Attributes\n\n- **Database Tables and Column Field Annotation**: Support for detailed annotations in generated structs.\n- **JSON Tag**: Automatic JSON tag output in structs.\n- **GORM.Model**: Inclusion of GORM's built-in model features.\n- **PRIMARY_KEY**: Specifies a column as the primary key.\n- **UNIQUE**: Marks a column as unique.\n- **NOT NULL**: Marks a column as NOT NULL.\n- **INDEX**: Allows the creation of indexes, with or without a name; using the same name creates composite indexes.\n- **UNIQUE_INDEX**: Similar to INDEX, but creates a unique index.\n- **GEOMETRY**: Support for geometry data type.\n\n### Installation\n\nInstall the tool using the following Go command:\n\n `go get github.com/wonli/gormt@latest`\n \n### Usage\n\n```go\npackage main\n\nimport (\n\t\"github.com/wonli/gormt\"\n\t\"github.com/wonli/gormt/config\"\n)\n\nfunc main() {\n\tdbInfo := config.DBInfo{\n\t\tHost:     \"127.0.0.1\",\n\t\tPort:     3306,\n\t\tUsername: \"root\",\n\t\tPassword: \"123456\",\n\t\tDatabase: \"test\",\n\t\tType:     0,\n\t}\n\n\tconf := config.Config{\n\t\tDBInfo:           dbInfo,\n\t\tPkgName:          \"schema\", \n\t\tOutDir:           \"./examples/model\", \n\t\tDbTag:            \"gorm\",\n\t\tIsJsonTag:        true,\n\t\tIsNullToSqlNull:  true,\n\t\tTablePrefix:      \"q_\",\n\t\tStripTablePrefix: true,\n\t\tOutFileName:      \"schema\",\n\t}\n\n\tgormt.ExecuteConfig(\u0026conf)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonli%2Fgormt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwonli%2Fgormt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonli%2Fgormt/lists"}