{"id":22368356,"url":"https://github.com/olexnzarov/protomask","last_synced_at":"2026-05-03T19:33:21.684Z","repository":{"id":195544864,"uuid":"693157094","full_name":"olexnzarov/protomask","owner":"olexnzarov","description":"A package that makes protobuf messages and field masks just work together","archived":false,"fork":false,"pushed_at":"2023-09-20T16:07:10.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T16:12:41.372Z","etag":null,"topics":["assign","fieldmask","go","grpc","protobuf","update"],"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/olexnzarov.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":"2023-09-18T13:15:20.000Z","updated_at":"2023-09-18T13:21:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"159ee53a-6130-4fa6-ba7f-e6919f08a4bf","html_url":"https://github.com/olexnzarov/protomask","commit_stats":null,"previous_names":["olexnzarov/protomask"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/olexnzarov/protomask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olexnzarov%2Fprotomask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olexnzarov%2Fprotomask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olexnzarov%2Fprotomask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olexnzarov%2Fprotomask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/olexnzarov","download_url":"https://codeload.github.com/olexnzarov/protomask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/olexnzarov%2Fprotomask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32582729,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: 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":["assign","fieldmask","go","grpc","protobuf","update"],"created_at":"2024-12-04T18:29:07.274Z","updated_at":"2026-05-03T19:33:21.661Z","avatar_url":"https://github.com/olexnzarov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protomask [![GoDoc](https://pkg.go.dev/badge/github.com/olexnzarov/protomask)](https://pkg.go.dev/github.com/olexnzarov/protomask) [![Github release](https://img.shields.io/github/release/olexnzarov/protomask.svg)](https://github.com/olexnzarov/protomask/releases) [![Test status](https://github.com/olexnzarov/protomask/actions/workflows/tests.yml/badge.svg)](https://github.com/olexnzarov/protomask/actions/workflows/tests.yml)\n\nprotomask is a package that lets you update protobuf messages with a help of field masks.\n\n**Features**\n\n- Assign values from one message to another based on a field mask.\n- Create a mask of all populated fields of a message. \n- Supports nested fields, and handles their parent being nil.\n- Supports [fieldmaskpb](https://google.golang.org/protobuf/types/known/), including `oneof` properties.\n\n## Installation\n\n```sh\ngo get github.com/olexnzarov/protomask\n```\n\n## Usage\n\n```go\nfunc (s *BookServer) UpdateBookPrice(id int64, priceCents int64) error {\n  update := \u0026pb.Book{\n    Id: id,\n    Price: \u0026pb.Price{\n      Cents: priceCents,\n    },\n  }\n  mask, _ := fieldmaskpb.New(update, \"price.cents\")\n  return s.UpdateBook(update, mask)\n}\n\nfunc (s *BookServer) UpdateBook(update *pb.Book, updateMask protomask.FieldMask) error {\n  book, err := s.bookStorage.GetById(update.Id)\n  if err != nil {\n    return err\n  }\n  err = protomask.Update(book, update, updateMask)\n  if err != nil {\n    return err\n  }\n  return s.bookStorage.Save(book)\n}\n```\n\n## Examples\n\nSee [protomask_test.go](./protomask_test.go) for more examples on how to use the package. Also, you can check out [gofu](https://github.com/olexnzarov/gofu) for a real-life example of how it can be used.\n\n## License\n\nThis code is available under the MIT license, allowing for free use, modification, and distribution.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folexnzarov%2Fprotomask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Folexnzarov%2Fprotomask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Folexnzarov%2Fprotomask/lists"}