{"id":20136983,"url":"https://github.com/txix-open/gooc","last_synced_at":"2026-04-24T22:32:59.941Z","repository":{"id":57519645,"uuid":"169367353","full_name":"txix-open/gooc","owner":"txix-open","description":"Golang object cleaner","archived":false,"fork":false,"pushed_at":"2019-03-24T07:13:52.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-12T00:32:56.645Z","etag":null,"topics":["cleaner","go","json","sanitizer"],"latest_commit_sha":null,"homepage":null,"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/txix-open.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}},"created_at":"2019-02-06T07:04:08.000Z","updated_at":"2019-03-24T07:13:53.000Z","dependencies_parsed_at":"2022-08-30T04:22:39.475Z","dependency_job_id":null,"html_url":"https://github.com/txix-open/gooc","commit_stats":null,"previous_names":["txix-open/gooc","integration-system/gooc"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/txix-open/gooc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txix-open%2Fgooc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txix-open%2Fgooc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txix-open%2Fgooc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txix-open%2Fgooc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/txix-open","download_url":"https://codeload.github.com/txix-open/gooc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txix-open%2Fgooc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32243309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"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":["cleaner","go","json","sanitizer"],"created_at":"2024-11-13T21:24:40.568Z","updated_at":"2026-04-24T22:32:59.898Z","avatar_url":"https://github.com/txix-open.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GOOC (Golang object cleaner)\n\n## Features\n* Clean object by specified properties list;\n* Do not mutate original objects;\n* Works with Golang maps and slices;\n* Supports partially properties matching.\n\n## Install\n\n```\ngo get github.com/integration-system/gooc\n```\n\n## Example\n\nSource data:\n```json\n{\n  \"a\": {\n    \"b\": [{\"c\": \"c\", \"c1\": \"c2\", \"c2\": \"c2\"}],\n    \"d\": [\"1\", \"2\", \"3\"],\n    \"i\": 111,\n    \"o\": {}\n  },\n  \"k\": [{\"c1\": \"c1\", \"c2\": \"c2\", \"c3\": \"c3\"}, {\"c1\": \"c1\", \"c2\": \"c2\", \"c3\": \"c3\"}],\n  \"v\": [{\"c\": false, \"i\": \"i\", \"ops\": \"ops\"}, {\"c\": true, \"i\": \"i\", \"ops\": \"ops\"}],\n  \"j\": \"j\"\n}\n```\n```go\nwl := []string{\"a.b.c\", \"a.b\", \"a.d\", \"k\", \"v.i\", \"j\"}\nc := gooc.NewCleaner(wl, nil)\nresult := c.Apply(m)\n```\nResult:\n```json\n{\n  \"a\": {\n    \"b\": [{\"c\": \"c\", \"c1\": \"c2\", \"c2\": \"c2\"}],\n    \"d\": [\"1\", \"2\", \"3\"]\n  },\n  \"j\": \"j\",\n  \"k\": [{\"c1\": \"c1\", \"c2\": \"c2\", \"c3\": \"c3\"}, {\"c1\": \"c1\", \"c2\": \"c2\", \"c3\": \"c3\"}],\n  \"v\": [{\"i\": \"i\"}, {\"i\": \"i\"}]\n}\n```\n## Notes\n1) Cleaner object is thread safe\n2) If no properties matches returns `nil`\n3) Use `*` in whitelist to allow all properties from root\n4) White and black list composition\n* 'Black' list has higher priority than 'white'\n* Some cases:\n\n| Whitelist    | Blacklist    | Result                           |\n|--------------|--------------|----------------------------------|\n| `['*']`      | `['*']`      | No available fields              |\n| `['a', 'b']` | `['*']`      | No available fields              |\n| `['*']`      | `['a', 'b']` | All available except `a` and `b` |\n| `['a', 'b']` | `['b, 'd']`  | Available only `a`               |\n\n\n\n## TODO\n* [ ] Full object copy option\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxix-open%2Fgooc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftxix-open%2Fgooc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxix-open%2Fgooc/lists"}