{"id":37107178,"url":"https://github.com/golaxo/gofieldselect","last_synced_at":"2026-01-14T12:53:21.275Z","repository":{"id":328788071,"uuid":"1115195850","full_name":"golaxo/gofieldselect","owner":"golaxo","description":"Apply field selection pattern to your REST apis.","archived":false,"fork":false,"pushed_at":"2025-12-16T13:28:42.000Z","size":33,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-18T09:54:45.156Z","etag":null,"topics":["fields","go","golang","odata","query-parameters","rest","rest-api","restful-api","select"],"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/golaxo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-12T13:35:56.000Z","updated_at":"2025-12-18T07:52:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/golaxo/gofieldselect","commit_stats":null,"previous_names":["golaxo/gofieldselect"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/golaxo/gofieldselect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golaxo%2Fgofieldselect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golaxo%2Fgofieldselect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golaxo%2Fgofieldselect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golaxo%2Fgofieldselect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golaxo","download_url":"https://codeload.github.com/golaxo/gofieldselect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golaxo%2Fgofieldselect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["fields","go","golang","odata","query-parameters","rest","rest-api","restful-api","select"],"created_at":"2026-01-14T12:53:20.563Z","updated_at":"2026-01-14T12:53:21.266Z","avatar_url":"https://github.com/golaxo.png","language":"Go","readme":"# Go Field Select\n\n[![version](https://img.shields.io/github/v/release/golaxo/gofieldselect)](https://img.shields.io/github/v/release/golaxo/gofieldselect)\n[![CI](https://github.com/golaxo/gofieldselect/actions/workflows/ci.yml/badge.svg)](https://github.com/golaxo/gofieldselect/actions/workflows/ci.yml)\n[![PR checks](https://github.com/golaxo/gofieldselect/actions/workflows/pr-checks.yml/badge.svg)](https://github.com/golaxo/gofieldselect/actions/workflows/pr-checks.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/golaxo/gofieldselect)](https://goreportcard.com/report/github.com/golaxo/gofieldselect)\n\n\u003e [!WARNING]\n\u003e GoFieldSelect is under heavy development.\n\nA powerful `select` query parameter implementation based on [Field selection][field-selection] for filtering desired fields in a REST API.\n\n## ⬇️ Getting Started\n\nTo start using it:\n\n```bash\ngo get github.com/golaxo/gofieldselect@latest\n```\n\nAnd then use it either by\n\n### Using Get for each field\n\n```go\nn, err := gofieldselect.Parse(\"name,address(street)\")\nan, _ := fieldSelection.SelectField(\"address\")\n\ndto := examples.User{\n    Name:    gofieldselect.Get(n, \"name\", user.Name),\n    Surname: gofieldselect.Get(n, \"surname\", user.Surname),\n    Age:     gofieldselect.Get(n, \"age\", user.Age),\n    Address: \u0026examples.Address{\n        Street: gofieldselect.Get(an.Child, \"street\", user.Address.Street),\n        Number: gofieldselect.Get(an.Child, \"number\", user.Address.Number),\n    },\n}\n\n// dto only contains `name` and `address.street` set, the rest of the fields contain the default value.\n```\n\nCheck [examples/get](./examples/get/main.go) to see it in action.\n\n### Reflection for an existing instance\n\n```go\nn, _ := gofieldselect.Parse(\"name,surname\")\nsrc := User{Name: \"John\", Surname: \"Doe\", Age: 20}\nselected, _ := gofieldselect.GetWithReflection(n, src)\n// selected only contains `name` and `surname` set, `age` is set to its default value.\n```\n\nCheck [examples/getwithreflection](./examples/getwithreflection/main.go) to see it in action.\n\n## 🚀 Features\n\nGoFieldSelect provides a way to return only certain fields. It can be used as a query parameter in your REST endpoints.\n\nImagine you have the following JSON:\n\n```json\n{\n  \"id\": 1,\n  \"name\": \"John\",\n  \"address\": {\n    \"street\": \"Example street\",\n    \"number\": \"1\"\n  }\n}\n```\n\n### Root field selection\n\nJSON selecting some fields: `?fields=id,name`:\n\n```json\n{\n  \"id\": 1,\n  \"name\": \"John\"\n}\n```\n\n### Nested field selection\n\nJSON selecting some fields: `?fields=id,name,address(street)`:\n\n```json\n{\n  \"id\": 1,\n  \"name\": \"John\",\n  \"address\": {\n    \"street\": \"Example street\"\n  }\n}\n```\n\n[field-selection]: https://learn.microsoft.com/en-us/azure/data-api-builder/keywords/select-rest\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolaxo%2Fgofieldselect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolaxo%2Fgofieldselect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolaxo%2Fgofieldselect/lists"}