{"id":30407883,"url":"https://github.com/nadim147c/go-tree","last_synced_at":"2026-05-18T15:03:22.732Z","repository":{"id":288719591,"uuid":"968570736","full_name":"Nadim147c/go-tree","owner":"Nadim147c","description":"📦 A simple Go package for traversing 🌲tree like deeply nested data in go","archived":false,"fork":false,"pushed_at":"2025-06-10T08:21:13.000Z","size":43,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-01T00:31:00.928Z","etag":null,"topics":["golang","json","package","web-scraping"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nadim147c.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,"zenodo":null}},"created_at":"2025-04-18T10:19:13.000Z","updated_at":"2025-06-10T08:21:16.000Z","dependencies_parsed_at":"2025-04-20T13:49:43.406Z","dependency_job_id":null,"html_url":"https://github.com/Nadim147c/go-tree","commit_stats":null,"previous_names":["nadim147c/go-tree"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Nadim147c/go-tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim147c%2Fgo-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim147c%2Fgo-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim147c%2Fgo-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim147c%2Fgo-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nadim147c","download_url":"https://codeload.github.com/Nadim147c/go-tree/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim147c%2Fgo-tree/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271539817,"owners_count":24777495,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["golang","json","package","web-scraping"],"created_at":"2025-08-21T20:55:31.327Z","updated_at":"2026-05-18T15:03:22.726Z","avatar_url":"https://github.com/Nadim147c.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\u003cpre\u003ego-tree\u003c/pre\u003e\n\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003eSearch and traverse deeply nested data structures.\u003c/h3\u003e\n\n\u003ch1 align=\"center\"\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/Nadim147c/go-tree\"\u003e\n\u003cimg src=\"https://img.shields.io/github/go-mod/go-version/Nadim147c/go-tree?style=for-the-badge\u0026logo=go\u0026labelColor=11140F\u0026color=BBE9AA\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/Nadim147c/go-tree\"\u003e\n\u003cimg src=\"https://img.shields.io/github/stars/Nadim147c/go-tree?style=for-the-badge\u0026logo=github\u0026labelColor=11140F\u0026color=BBE9AA\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/Nadim147c/go-tree/blob/main/LICENSE\"\u003e\n\u003cimg src=\"https://img.shields.io/github/license/Nadim147c/go-tree?style=for-the-badge\u0026logo=gplv3\u0026labelColor=11140F\u0026color=BBE9AA\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/Nadim147c/go-tree/commits\"\u003e\n\u003cimg src=\"https://img.shields.io/github/last-commit/Nadim147c/go-tree?style=for-the-badge\u0026logo=git\u0026labelColor=11140F\u0026color=BBE9AA\"\u003e\n\u003c/a\u003e\n\u003c/h1\u003e\n\n## Description\n\nA Go package for **searching** and **traversing** deeply nested data structures\nsuch as maps, slices, arrays, and structs. It offers flexible utilities for extracting specific\nvalues or entire subtrees using custom filter logic.\n\n## Installation\n\n```bash\ngo get github.com/Nadim147c/go-tree/v3\n```\n\n## Features\n\n- Depth-first traversal of nested structures\n- Customizable filtering\n- Supports maps, slices, arrays, structs, and primitive types\n- Clear and predictable error handling\n\n## Usage\n\nSee the [example](./example/) directory for practical examples.\n\n## How it Works\n\n`go-tree` provides following capabilities:\n\n### Find\n\n- `Find\u003cType\u003e` functions (`FindString`, `FindBool`, `FindInt`, `FindUint`, `FindFloat`) scan the\n  tree and return the **first primitive value** of the specified type that satisfies the filter.\n- Type checks are performed **before** the filter is applied, ensuring only correctly-typed values\n  are evaluated.\n- The generic `Find` function returns the first matching **branch** (e.g., `map`, `slice`, `struct`)\n  without performing type filtering — useful for targeting nested structures for deeper inspection.\n\n### Collect\n\n- `Collect\u003cType\u003e` functions collect **all primitive values** of the specified type that match the\n  filter. These include `CollectString`, `CollectBool`, `CollectInt`, `CollectUint`, and\n  `CollectFloat`.\n- Type enforcement is done before applying the filter, ensuring that only relevant values are\n  processed.\n- The generic `Collect` collects **all matching branches**, useful for aggregating nested\n  collections of interest, regardless of their concrete type.\n\n### Has\n\n- `Has\u003cType\u003e` functions (`HasString`, `HasBool`, `HasInt`, `HasUInt`, `HasFloat`) traverse the\n  structure and return `true` if **any value of the specified type** satisfies the filter function.\n- These functions **automatically perform type checking** before applying the filter, which\n  simplifies filter logic but also restricts it to only matching values of the expected type.\n- The generic `Has` does **not enforce type constraints**, making it useful when the filter logic\n  needs to inspect or match across **multiple types or complex conditions**.\n\n# Summary\n\n- For **primitive values**, always prefer `Find\u003cType\u003e` and `Traverse\u003cType\u003e`.\n- Use **generic `Find` and `Traverse`** when working with **nested objects**.\n- Full API documentation is available through GoDoc or your IDE.\n- See [example](./example/) for practical usage.\n\n## License\n\nThis package is licensed under [GNU-LGPL-3.0](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadim147c%2Fgo-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnadim147c%2Fgo-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadim147c%2Fgo-tree/lists"}