{"id":17996308,"url":"https://github.com/lpxxn/yggdrasill","last_synced_at":"2025-03-26T04:30:32.709Z","repository":{"id":44435864,"uuid":"259832769","full_name":"lpxxn/yggdrasill","owner":"lpxxn","description":"yggdrasill can turn the table into a go struct，support PostgreSQL, MySQL ","archived":false,"fork":false,"pushed_at":"2020-05-29T09:25:07.000Z","size":299,"stargazers_count":44,"open_issues_count":0,"forks_count":16,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T05:22:01.061Z","etag":null,"topics":["auto-generate","go","mysql","postgresql","sql-builder"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lpxxn.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}},"created_at":"2020-04-29T05:28:03.000Z","updated_at":"2024-11-07T01:45:52.000Z","dependencies_parsed_at":"2022-09-12T18:50:52.869Z","dependency_job_id":null,"html_url":"https://github.com/lpxxn/yggdrasill","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpxxn%2Fyggdrasill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpxxn%2Fyggdrasill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpxxn%2Fyggdrasill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpxxn%2Fyggdrasill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lpxxn","download_url":"https://codeload.github.com/lpxxn/yggdrasill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245589104,"owners_count":20640225,"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":["auto-generate","go","mysql","postgresql","sql-builder"],"created_at":"2024-10-29T21:14:13.949Z","updated_at":"2025-03-26T04:30:32.235Z","avatar_url":"https://github.com/lpxxn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[中文简介](README.md)    \n[English](README_US.md)\n\nyggdrasill 把数据库的表转换成`go`语言的`struct`，支持 `PostgreSQL`, `MySQL`    \neg:    \n![generat model](/gen.gif)\n## 安装 \n安装到`GOPATH`的 `bin`目录.\n```\nGO111MODULE=on go get -u github.com/lpxxn/yggdrasill/cmd/yggdrasill\n```\n### 帮助\n```\nyggdrasill -help \n```\n```\nUsage of yggdrasill:\n  -dir string\n        Destination dir for files generated. (default \"./tmp\")\n  -dsn string\n        dsn (default \"postgresql\")\n  -package_name string\n        package name default model. (default \"model\")\n  -table_names value\n        if it is empty, will generate all tables in database\n  -target string\n        mysql postgresql[pg] (default \"postgresql\")\n  -template_path string\n        custom template file path\n\n```\n\n\n## 命令\n\n### MySql\n`-target`为 `mysql`\n默认生成数据库内的所有表\n```\nyggdrasill -target=mysql -dsn=\"root:123456@tcp(127.0.0.1:3306)/test\" \n```\n也可以生成指定表，使用 `-table_names` 指定想生成的表    \n```\nyggdrasill -target=mysql -dsn=\"root:123456@tcp(127.0.0.1:3306)/test\" -table_names=employee -table_names=user\n```\n\n### PostgreSql\n`-target` 为 `postgresql`或者`pg`\n默认生成数据库内的所有表\n```\nyggdrasill -target=pg -dsn=\"postgres://:@127.0.0.1:5432/test?sslmode=disable\"\n```\n使用 `-table_names` 指定想生成的表    \n```\nyggdrasill -target=pg -dsn=\"root:123456@tcp(127.0.0.1:3306)/test\" -table_names=employee -table_names=user\n```\n\n自定义 template\n使用 `-template_path` 自定义模板 \n```\nyggdrasill  -target=pg -dsn=\"postgres://:@127.0.0.1:5432/test?sslmode=disable\" -package_name=db_model -template_path=../../test/test_template.tml \n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpxxn%2Fyggdrasill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flpxxn%2Fyggdrasill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpxxn%2Fyggdrasill/lists"}