{"id":24083283,"url":"https://github.com/mitranim/rf","last_synced_at":"2026-05-15T10:09:06.080Z","repository":{"id":57539060,"uuid":"288252307","full_name":"mitranim/rf","owner":"mitranim","description":"Reflect utils: utilities missing from the \"reflect\" package in the Go standard library","archived":false,"fork":false,"pushed_at":"2022-12-22T13:00:59.000Z","size":163,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-24T06:44:39.678Z","etag":null,"topics":["golang","reflect","utils"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/mitranim/rf","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitranim.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-17T18:08:59.000Z","updated_at":"2023-08-01T09:09:15.000Z","dependencies_parsed_at":"2023-01-30T09:31:30.371Z","dependency_job_id":null,"html_url":"https://github.com/mitranim/rf","commit_stats":null,"previous_names":["mitranim/refut"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Frf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Frf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Frf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitranim%2Frf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitranim","download_url":"https://codeload.github.com/mitranim/rf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240959115,"owners_count":19884911,"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":["golang","reflect","utils"],"created_at":"2025-01-09T23:56:17.298Z","updated_at":"2026-05-15T10:09:01.044Z","avatar_url":"https://github.com/mitranim.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Overview\n\nShort for \"**r**e**f**lect utils\": utilities missing from the \"reflect\" package in the Go standard library. Small and dependency-free.\n\nSee the full documentation at https://pkg.go.dev/github.com/mitranim/rf.\n\n## Changelog\n\n### v0.5.2\n\nWalking now avoids stack overflow on cyclic types. More specifically, it avoids infinite recursion when generating walkers for cyclic types. Note that fully walking cyclic types is not yet supported; instead, inner occurrences of a cyclic type are ignored, and only the outermost occurrence is walked. This limitation may be lifted in future versions.\n\n### v0.5.1\n\nWalking now ignores private fields.\n\n### v0.5.0\n\nConverted the following tools to generics, for better type safety and efficiency:\n\n* `TypeFilter`\n* `IfaceFilter`\n* `ShallowIfaceFilter`\n* `Appender`\n* `Trawl`\n* `TrawlWith`\n\nAdded `KindFilter` (untested).\n\nAdded `Type`.\n\n### v0.4.2\n\nRename `WalkFuncPtr` → `WalkPtrFunc`.\n\n### v0.4.1\n\nAdd `WalkPtr` and `WalkFuncPtr`. Remove `DerefPtr` because it made no sense.\n\n### v0.4.0\n\nAdded:\n\n  * `ValueAddr`\n  * `Interface`\n  * `DeepFields`\n  * `TypeDeepFields`\n  * `OffsetFields`\n  * `TypeOffsetFields`\n  * `Path`\n  * `Rev`\n\nBreaking changes:\n\n  * Renamed all functions starting with `DerefValue*` to begin with `Deref*`.\n  * Replaced `CopyPath` with `Path.Copy`.\n\n`DeepFields` and `TypeDeepFields` is a particularly useful addition, as it supports \"flattening\" structs, simplifying most use cases that involve struct iteration.\n\n### v0.3.3\n\nAdd `IfaceFilterFor`, `ShallowIfaceFilterFor`.\n\n### v0.3.2\n\nReverted breaking change in `v0.3.1`: `IfaceFilter` once again allows to visit descendants. Added `ShallowIfaceFilter` that doesn't visit descendants of a matching node.\n\n### v0.3.1\n\nQuick breaking change: `IfaceFilter` visits either self or descendants, not both.\n\n### v0.3.0\n\nMore flexible `Filter` interface:\n\n  * Previous approach: filter returns `bool` answering \"should visit this node\". 2 possible states. Implicitly walks descendants.\n\n  * New approach: filter returns flagset where \"should visit this node\" and \"should walk descendants\" are both optional flags. 4 possible states. Walking descendants is now optional.\n\nRenamed `Filter.ShouldVisit` to `Filter.Visit` because it's no longer a boolean. This makes it impossible to implement `Filter` and `Walker` on the same type, which is probably a good thing due to filter equality rules.\n\n`Nop` no longer implements `Filter`.\n\nReplaced `True` and `False` with `Self`, `Desc`, `Both`, `All`.\n\nReplaced `Not` with `InvertSelf`.\n\nRenamed `DerefLen` to `Len`.\n\n### v0.2.2\n\nAdded `Fields` and `TypeFields` for micro-optimizing struct shallow walking.\n\n### v0.2.1\n\n`Walk` / `GetWalker` now support walking into `interface{}` values, fetching the appropriate cached walker for the given type and filter on the fly.\n\nAdded `MaybeOr`, `MaybeAnd`, `GetTypeFilter`, `TypeFilterFor` for micro-optimizing filter allocations.\n\n### v0.2.0\n\nComplete revision.\n\n* Removed useless or rarely-used utils.\n* Added many missing utils.\n* New approach to walking / traversal. The old naive approach walked the entire structure every time. The new approach is to JIT-compile a precise walker that visits just what you need, caching it for a combination of type + filter. This makes walking dramatically more efficient.\n* Added `Cache` for generating and caching arbitrary type-dependent structures.\n* Renamed from `github.com/mitranim/refut` to `github.com/mitranim/rf` for brevity.\n\n## License\n\nhttps://unlicense.org\n\n## Misc\n\nI'm receptive to suggestions. If this library _almost_ satisfies you but needs changes, open an issue or chat me up. Contacts: https://mitranim.com/#contacts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitranim%2Frf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitranim%2Frf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitranim%2Frf/lists"}