{"id":20230382,"url":"https://github.com/manuelarte/milogo","last_synced_at":"2026-02-23T08:06:39.148Z","repository":{"id":262172228,"uuid":"886421148","full_name":"manuelarte/milogo","owner":"manuelarte","description":"JSON Partial response (aka field selection) plugin for Gin.","archived":false,"fork":false,"pushed_at":"2025-01-11T09:38:21.000Z","size":50,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T10:31:08.546Z","etag":null,"topics":["field-selection","gin-gonic","go","golang","middleware","partial-responses","rest-api"],"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/manuelarte.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"manuelarte","patreon":"manuelarte","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-11-10T23:51:42.000Z","updated_at":"2025-01-11T09:38:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc21dc60-e820-4882-90e3-718afa177415","html_url":"https://github.com/manuelarte/milogo","commit_stats":null,"previous_names":["manuelarte/milogo"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelarte%2Fmilogo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelarte%2Fmilogo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelarte%2Fmilogo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelarte%2Fmilogo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manuelarte","download_url":"https://codeload.github.com/manuelarte/milogo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233824488,"owners_count":18736009,"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":["field-selection","gin-gonic","go","golang","middleware","partial-responses","rest-api"],"created_at":"2024-11-14T07:42:21.716Z","updated_at":"2026-02-23T08:06:39.141Z","avatar_url":"https://github.com/manuelarte.png","language":"Go","readme":"# ✂️ Milogo ✂️\n\n[![Go](https://github.com/manuelarte/milogo/actions/workflows/go.yml/badge.svg)](https://github.com/manuelarte/milogo/actions/workflows/go.yml)\n![coverage](https://raw.githubusercontent.com/manuelarte/milogo/badges/.badges/main/coverage.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/manuelarte/milogo)](https://goreportcard.com/report/github.com/manuelarte/milogo)\n![version](https://img.shields.io/github/v/release/manuelarte/milogo)\n\nRest Partial Response (aka Field Selection) Pattern middleware for [Gin](https://gin-gonic.com/).\nThis gin middleware allows you to select a subset of fields to be returned from your endpoints.\n\n\u003cimg src=\"logo.png\" alt=\"logo\" width=\"256\" height=\"256\" /\u003e\n\ne.g., Imagine that you have the following rest endpoint that returns a user with the fields, `id, name, surname, age, address`:\n\u003e /users/1\n\n```json\n{\n \"id\": 1,\n \"name\": \"John\",\n \"surname\": \"Doe\",\n \"age\": 18,\n \"address\": {\n   \"street\": \"mystreet\",\n   \"city\": \"mycity\",\n   \"country\": \"mycountry\",\n   \"zipcode\": \"1111\"\n }\n}\n```\n\nWe can call the endpoint and, with the query parameter fields, filter out the fields that we are interested:\n\u003e /users/1?**fields=name,surname**\n\n```json\n{\n \"name\": \"John\",\n \"surname\": \"Doe\"\n}\n```\n\n## 📝 How To Install It And Use It\n\n- Run the command:\n\n\u003e go get -u -d github.com/manuelarte/milogo\n\n- Add milogo middleware\n\n```go\nr := gin.Default()\nr.Use(Milogo())\n```\n\n- Call your endpoints adding the query parameter `fields` with the fields you want to filter:\n\n\u003e /users/1?**fields=name,surname**\n\n## ✨ Features\n\n- [Support for multiple fields filtering](./examples/simple).\n\n\u003e /users/1?fields=name,surname\n\n```json\n{\n \"name\": \"John\",\n \"surname\": \"Doe\"\n}\n```\n\n- [Support for arrays](./examples/simple-array)\n\n\u003e /users?fields=name\n\n```json\n[\n  {\n    \"name\": \"John\"\n  }\n]\n```\n\n- [Support for nested jsons](./examples/nested).\n\n\u003e /users/1?fields=name,surname,address(street,zipcode)\n\n```json\n{\n \"name\": \"John\",\n \"surname\": \"Doe\",\n \"address\": {\n   \"street\": \"mystreet\",\n   \"zipcode\": \"myzipcode\"\n }\n}\n```\n\n- [Support for wrapped json](./examples/wrapped).\n\n\u003e /users/1?fields=name\n\n```json\n{\n \"data\": {\n    \"name\": \"John\"\n }\n}\n```\n\n- [Middleware applied to route groups with different configuration](./example/routeGroups)\n\nMilogo middleware, as any other gin middleware, can be applied to different route groups with different configurations.\n\n## 🤝 Contributing\n\nFeel free to create a PR or suggest improvements or ideas.\n","funding_links":["https://github.com/sponsors/manuelarte","https://patreon.com/manuelarte"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelarte%2Fmilogo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanuelarte%2Fmilogo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelarte%2Fmilogo/lists"}