{"id":13713857,"url":"https://github.com/idoubi/sql2struct","last_synced_at":"2025-04-05T00:09:52.252Z","repository":{"id":37285872,"uuid":"108747374","full_name":"idoubi/sql2struct","owner":"idoubi","description":"A developer-friendly tool for transfering sql statement to go struct.","archived":false,"fork":false,"pushed_at":"2023-12-29T09:20:42.000Z","size":2064,"stargazers_count":534,"open_issues_count":13,"forks_count":117,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-28T23:08:19.162Z","etag":null,"topics":["go","golang","sql"],"latest_commit_sha":null,"homepage":"https://dou.tools/sql2struct/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idoubi.png","metadata":{"files":{"readme":"README-CN.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-10-29T15:42:56.000Z","updated_at":"2025-02-09T03:53:05.000Z","dependencies_parsed_at":"2024-06-18T20:02:02.524Z","dependency_job_id":null,"html_url":"https://github.com/idoubi/sql2struct","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idoubi%2Fsql2struct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idoubi%2Fsql2struct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idoubi%2Fsql2struct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idoubi%2Fsql2struct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idoubi","download_url":"https://codeload.github.com/idoubi/sql2struct/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266565,"owners_count":20910836,"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","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":["go","golang","sql"],"created_at":"2024-08-02T23:01:46.161Z","updated_at":"2025-04-05T00:09:52.231Z","avatar_url":"https://github.com/idoubi.png","language":"TypeScript","readme":"# sql2struct\n\nSQL2Struct 是一个可以将 SQL 语句转换成 Go struct 的工具。\n\n## 在线使用\n\n点击 [sql2struct 在线版](https://dou.tools/sql2struct/) 进行使用\n\n## 作为 Chrome 插件使用\n\n1. 使用源码安装 sql2struct\n\n```shell\ngit clone https://github.com/idoubi/sql2struct.git\ncd sql2struct\npnpm install\n```\n\n2. 构建 Chrome 插件代码\n\n```shell\npnpm build:chrome\n```\n\n3. 本地安装 Chrome 插件\n\nChrome 浏览器打开 [chrome://extensions/](chrome://extensions/)\n\n点击”加载已解压的扩展程序“，选择 sql2struct 根目录下的 `dist/chrome` 文件夹\n\n## 本地部署使用\n\n1. 使用源码安装 sql2struct\n\n```shell\ngit clone https://github.com/idoubi/sql2struct.git\ncd sql2struct\npnpm install\n```\n\n2. 预览\n\n```shell\npnpm dev\n```\n\n3. 构建\n\n```shell\npnpm build\n\n# or\n\npnpm build:web\n```\n\n## 如何使用\n\n1. 打开数据库客户端，执行 `show create table xxx\\G;` 导出 SQL 建表数据\n\n![20220626221324](https://blogcdn.idoustudio.com/blog/20220626221324.png)\n\n2. 粘贴 SQL 建表语句至 sql2struct 左侧的输入框\n\n![20220626222145](https://blogcdn.idoustudio.com/blog/20220626222145.png)\n\n粘贴完 SQL 建表语句后，右侧输入框自动生成转换后的 Go struct 代码，复制粘贴到 Go 项目中使用即可\n\n3. 转换配置项\n\n默认情况下，转换成的 Go struct 会带有一个 json 标签。你也可以勾选其他标签。目前支持 json、xml、gorm、xorm、mapstruct 等标签。\n\n![20220626222618](https://blogcdn.idoustudio.com/blog/20220626222618.png)\n\n点击 Options 按钮，进入设置页面\n\n在 Special Identifiers 配置项，你可以自定义需要全部转换成大写的关键词。\n\n![20220626222854](https://blogcdn.idoustudio.com/blog/20220626222854.png)\n\n在 Fiedl Maps 配置项，你可以自定义 SQL 字段与 Go struct 字段的映射关系。\n\n![20220626222912](https://blogcdn.idoustudio.com/blog/20220626222912.png)\n\n## 其他\n\n欢迎在 Github Issues 提交反馈，欢迎 fork 源码，参与共建。\n\n有任何问题你也可以通过邮件联系我： \u003cme@idoubi.cc\u003e.\n","funding_links":[],"categories":["Repositories"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidoubi%2Fsql2struct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidoubi%2Fsql2struct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidoubi%2Fsql2struct/lists"}