{"id":20545812,"url":"https://github.com/zcyc/protoc-gen-gf","last_synced_at":"2025-04-14T10:12:30.047Z","repository":{"id":104285487,"uuid":"558355094","full_name":"zcyc/protoc-gen-gf","owner":"zcyc","description":"Extension of protoc, generating CRUD of goframe","archived":false,"fork":false,"pushed_at":"2024-12-19T05:12:00.000Z","size":113,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T10:12:19.302Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zcyc.png","metadata":{"files":{"readme":"README.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":"2022-10-27T11:40:48.000Z","updated_at":"2024-12-27T19:16:42.000Z","dependencies_parsed_at":"2023-10-11T16:29:34.488Z","dependency_job_id":null,"html_url":"https://github.com/zcyc/protoc-gen-gf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcyc%2Fprotoc-gen-gf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcyc%2Fprotoc-gen-gf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcyc%2Fprotoc-gen-gf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcyc%2Fprotoc-gen-gf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zcyc","download_url":"https://codeload.github.com/zcyc/protoc-gen-gf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860188,"owners_count":21173342,"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":[],"created_at":"2024-11-16T01:53:26.257Z","updated_at":"2025-04-14T10:12:30.038Z","avatar_url":"https://github.com/zcyc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protoc-gen-gf\n\nGenerate [GoFrame](https://github.com/gogf/gf) business via proto file\n\n## Introduction\n\n- [protoc-gen-gf-api](./protoc-gen-gf-api) for api\n- [protoc-gen-gf-controller](./protoc-gen-gf-controller) for controller\n- [protoc-gen-gf-logic](./protoc-gen-gf-logic) for logic\n- [protoc-gen-gf-model](./protoc-gen-gf-model) for model\n- [protoc-gen-gf-client](./protoc-gen-gf-client) for client\n\n## Workflow\n- Generate the `proto` file by [mysql-to-proto](https://github.com/zcyc/mysql-to-proto) \n- Adjust the `services` and `messages` in the `proto`, please don't use the `PATCH` method, the generator will generate `CRUD` for it\n- Generate the `CRUD` by `protoc-gen-gf`\n- Copy the `files` to the `package` you want to place\n- Adjust the fields of `Req` and `Res` in the `api`\n- Adjust the fields of `Input` and `Output` in the `model`\n- Adjust the functions in the `logic`\n- Initialize your `DB` and `NoSQL` in the `cmd`\n- Initialize your `logic` in the `cmd`\n- Initialize your `controller` in the `cmd`\n- `Run` and `Test`\n\n## Environment\n\n### Download clis\n\n- [go 1.18+](https://golang.org/dl/)\n- [protoc](https://github.com/protocolbuffers/protobuf/releases)\n\n### Download protos\n```shell\nmkdir $GOPATH/src/google \u0026\u0026 cd $GOPATH/src/google\n```\n```shell\ngit clone --depth 1 https://github.com/googleapis/googleapis.git \u0026\u0026 mv googleapis/google/api $GOPATH/src/google \u0026\u0026 rm -rf googleapis\n```\n```shell\ngit clone --depth 1 https://github.com/protocolbuffers/protobuf.git protobuf1 \u0026\u0026 mv protobuf1/src/google/protobuf $GOPATH/src/google \u0026\u0026 rm -rf protobuf1\n```\n```shell\nfind $GOPATH/src/google -type f ! -name \"*.proto\" -delete \u0026\u0026 find $GOPATH/src/google -type d -empty -delete\n```\n\n## Install\n\n### macOS \u0026 Linux\n\n```shell\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@latest \u0026\u0026 \\\ngo install github.com/zcyc/protoc-gen-gf/protoc-gen-gf-api@main \\\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-controller@main \\\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-logic@main \\\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-model@main \\\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-client@main\n```\n\n### Windows\n\n#### PowerShell\n\n```powershell\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@latest \u0026\u0026 `\ngo install github.com/zcyc/protoc-gen-gf/protoc-gen-gf-api@main `\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-controller@main `\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-logic@main `\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-model@main `\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-client@main\n```\n\n#### CMD\n\n```bash\ngo install google.golang.org/protobuf/cmd/protoc-gen-go@latest \u0026\u0026 ^\ngo install github.com/zcyc/protoc-gen-gf/protoc-gen-gf-api@main ^\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-controller@main ^\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-logic@main ^\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-model@main ^\n           github.com/zcyc/protoc-gen-gf/protoc-gen-gf-client@main\n```\n\n## Usage\n\n### macOS \u0026 Linux\n\n```shell\nprotoc -I ./api -I $GOPATH/src \\\n       --go_out ./api --go_opt=paths=source_relative \\\n       --gf-api_out ./api --gf-api_opt=paths=source_relative \\\n       --gf-controller_out ./api --gf-controller_opt=paths=source_relative \\\n       --gf-logic_out ./api --gf-logic_opt=paths=source_relative \\\n       --gf-model_out ./api --gf-model_opt=paths=source_relative \\\n       --gf-client_out ./api --gf-client_opt=paths=source_relative \\\n       ./api/v1/article.proto\n```\n\n### Windows\n\n#### PowerShell\n\n```powershell\nprotoc -I ./api -I $env:GOPATH/src `\n       --go_out ./api --go_opt=paths=source_relative `\n       --gf-api_out ./api --gf-api_opt=paths=source_relative `\n       --gf-controller_out ./api --gf-controller_opt=paths=source_relative `\n       --gf-logic_out ./api --gf-logic_opt=paths=source_relative `\n       --gf-model_out ./api --gf-model_opt=paths=source_relative `\n       --gf-client_out ./api --gf-client_opt=paths=source_relative `\n       ./api/v1/article.proto\n```\n\n#### CMD\n\n```bash\nprotoc -I ./api -I %GOPATH%/src ^\n       --go_out ./api --go_opt=paths=source_relative ^\n       --gf-api_out ./api --gf-api_opt=paths=source_relative ^\n       --gf-controller_out ./api --gf-controller_opt=paths=source_relative ^\n       --gf-logic_out ./api --gf-logic_opt=paths=source_relative ^\n       --gf-model_out ./api --gf-model_opt=paths=source_relative ^\n       --gf-client_out ./api --gf-client_opt=paths=source_relative ^\n       ./api/v1/article.proto\n```\n\n## Demo\n\n[artcle](./example)\n\n## Thanks\n\n- [kratos](https://github.com/go-kratos/kratos/tree/main/cmd/protoc-gen-go-http)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzcyc%2Fprotoc-gen-gf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzcyc%2Fprotoc-gen-gf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzcyc%2Fprotoc-gen-gf/lists"}