{"id":37127498,"url":"https://github.com/xoxoist/morph","last_synced_at":"2026-01-14T14:50:51.751Z","repository":{"id":64298199,"uuid":"566097538","full_name":"xoxoist/morph","owner":"xoxoist","description":"🌊 Conversion tool between protoc stub and struct","archived":false,"fork":false,"pushed_at":"2023-07-06T09:38:06.000Z","size":2204,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T22:14:17.172Z","etag":null,"topics":["go-protobuf","protobuf3","protobuffer","protoc","protoc-plugin","protocol","protocol-buffers"],"latest_commit_sha":null,"homepage":"","language":"Go","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/xoxoist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-11-15T00:41:37.000Z","updated_at":"2023-03-28T23:46:43.000Z","dependencies_parsed_at":"2024-06-20T11:00:51.649Z","dependency_job_id":null,"html_url":"https://github.com/xoxoist/morph","commit_stats":null,"previous_names":["xoxoist/morph","coffeehaze/morph"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/xoxoist/morph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoxoist%2Fmorph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoxoist%2Fmorph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoxoist%2Fmorph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoxoist%2Fmorph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xoxoist","download_url":"https://codeload.github.com/xoxoist/morph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xoxoist%2Fmorph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28424001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["go-protobuf","protobuf3","protobuffer","protoc","protoc-plugin","protocol","protocol-buffers"],"created_at":"2026-01-14T14:50:50.917Z","updated_at":"2026-01-14T14:50:51.713Z","avatar_url":"https://github.com/xoxoist.png","language":"Go","readme":"# Morph\n\n\u003cimg align=\"right\" width=\"159px\" src=\"https://raw.githubusercontent.com/xoxoist/asset/main/morph.png\"\u003e\n\n[![xoxoist](https://circleci.com/gh/xoxoist/morph.svg?style=svg)](https://github.com/xoxoist/morph)\n[![codecov](https://img.shields.io/codecov/c/github/xoxoist/morph.svg)](https://codecov.io/gh/xoxoist/morph)\n[![Sourcegraph](https://sourcegraph.com/github.com/xoxoist/morph/-/badge.svg)](https://sourcegraph.com/github.com/xoxoist/morph?badge)\n[![Go Report Card](https://goreportcard.com/badge/github.com/xoxoist/morph)](https://goreportcard.com/report/github.com/xoxoist/morph)\n[![GoDoc](https://pkg.go.dev/badge/github.com/xoxoist/morph?status.svg)](https://pkg.go.dev/github.com/xoxoist/morph?tab=doc)\n[![License](http://img.shields.io/badge/license-mit-blue.svg)](https://raw.githubusercontent.com/xoxoist/morph/main/LICENSE)\n\nMorph is simple tools that helps you work with protoc stub and struct, where you can convert protoc stub to struct, or\notherwise,\nsave your time by copying all attribute data, except (Objects, Slices, Array) to target struct or protoc.\n\n## Contents\n\n- [Morph](#morph)\n    - [Contents](#contents)\n    - [Installation](#installation)\n    - [Quick Start](#quick-start)\n    - [API Examples](#api-examples)\n        - [Conversion](#conversion)\n\n### Installation\n\n1. Required go installed on your machine\n\n```sh\ngo version\n```\n\n2. Get morph\n\n```sh\ngo get -u github.com/xoxoist/morph\n```\n\n3. Import morph\n\n```go\nimport \"github.com/xoxoist/morph\"\n```\n\n### Quick Start\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/xoxoist/morph\"\n\t\"github.com/xoxoist/morph/example/model\"\n\tpb \"github.com/xoxoist/morph/example/protobuf\"\n)\n\nfunc sampleStructToProtoc() *pb.Todo {\n\tvar todoProtocBlank = \u0026pb.Todo{}\n\ttodoStruct := model.Todo{\n\t\tID:            \"5b9e1416-1f06-4a61-a30a-0dcff164639b\",\n\t\tName:          \"Lloyd\",\n\t\tCompleted:     true,\n\t\tNumberCode:    129520,\n\t\tNumberProduct: 25983578228,\n\t\tCodes:         []model.Code{{1}, {4}, {9}},\n\t}\n\n\tfor _, c := range todoStruct.Codes {\n\t\ttodoCodeProtocBlank := \u0026pb.Code{}\n\t\tmorph.Struct(\u0026c).Protoc(todoCodeProtocBlank)\n\t\ttodoProtocBlank.Codes = append(todoProtocBlank.Codes, todoCodeProtocBlank)\n\t}\n\n\treturn todoProtocBlank\n}\n\nfunc sampleProtocToStruct(todoProtoc *pb.Todo) model.Todo {\n\tvar todo model.Todo\n\tmorph.Protoc(todoProtoc).Struct(\u0026todo)\n\n\tfor _, i := range todoProtoc.Codes {\n\t\tvar code model.Code\n\t\tmorph.Protoc(i).Struct(\u0026code)\n\t\ttodo.Codes = append(todo.Codes, code)\n\t}\n\n\treturn todo\n}\n\nfunc main() {\n\ttodoProtoc := sampleStructToProtoc()\n\tfmt.Println(fmt.Sprintf(\"protoc : %+v\", todoProtoc))\n\ttodoStruct := sampleProtocToStruct(todoProtoc)\n\tfmt.Println(fmt.Sprintf(\"struct : %+v\", todoStruct))\n}\n```\n\n### API Examples\n\n### Conversion\n\n- `morph.Struct(v interface{}) morph.ProtocTransformed`\n    ```go\n    // blank protoc\n    var todoProtocBlank = \u0026pb.Todo{}\n    todoStruct := model.Todo{\n        ID:            \"5b9e1416-1f06-4a61-a30a-0dcff164639b\",\n        Name:          \"Lloyd\",\n        Completed:     true,\n        NumberCode:    129520,\n        NumberProduct: 25983578228,\n    }\n    // binds all struct attributes to protoc attributes\n    morph.Struct(\u0026todoStruct).Protoc(todoProtocBlank)\n    ```\n\n- `morph.Protoc(v interface{}) morph.StructTransformed`\n    ```go\n    // blank struct\n    var todo model.Todo\n    todoProtoc := \u0026pb.Todo{\n        Id:            \"5b9e1416-1f06-4a61-a30a-0dcff164639b\",\n        Name:          \"Lloyd\",\n        Completed:     true,\n        NumberCode:    129520,\n        NumberProduct: 25983578228,\n    }\n    // binds all protoc attributes to struct attributes\n    morph.Protoc(todoProtoc).Struct(\u0026todo)\n    ```\n\n- `end`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxoxoist%2Fmorph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxoxoist%2Fmorph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxoxoist%2Fmorph/lists"}