{"id":16874633,"url":"https://github.com/joway/gobber","last_synced_at":"2025-03-18T23:18:58.824Z","repository":{"id":75055719,"uuid":"353326123","full_name":"joway/gobber","owner":"joway","description":"A Golang helper to access private struct field.","archived":false,"fork":false,"pushed_at":"2021-03-31T11:35:42.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T00:37:25.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joway.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-31T11:03:22.000Z","updated_at":"2022-01-28T23:53:55.000Z","dependencies_parsed_at":"2023-02-26T15:01:09.965Z","dependency_job_id":null,"html_url":"https://github.com/joway/gobber","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joway%2Fgobber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joway%2Fgobber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joway%2Fgobber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joway%2Fgobber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joway","download_url":"https://codeload.github.com/joway/gobber/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244320424,"owners_count":20434092,"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":[],"created_at":"2024-10-13T15:33:35.064Z","updated_at":"2025-03-18T23:18:58.799Z","avatar_url":"https://github.com/joway.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gobber\n\nA Golang helper to access private struct field.\n\n## Usage\n\n```go\ntype Car struct {\n    name string\n}\n\n//init\ngobber := gobber.New(Car{}) //Car{} just for gobber to setup struct metadata\n\n//set private field\ntarget := \u0026Car{name: \"old\"}\nok := gobber.Set(target, \"name\", \"new\")\n\n//get private field\nnamePtr := gobber.Get(target, \"name\")\nname := *(*string)(namePtr) //\"new\"\n```\n\n## How it works\n\n```text\n(address of the object) + (offset of the field in struct) == (address of the field)\n\n//Get\n*(*Type)(address of the field)\n\n//Set\n*(*Type)(address of the field) = *(*Type)(address of the new value)\n```\n\n## Benchmark\n\n```\nBenchmarkDirectlyGet-8   \t1000000000\t         0.286 ns/op\nBenchmarkGobberGet-8     \t100000000\t        10.2 ns/op\nBenchmarkDirectlySet-8   \t1000000000\t         0.285 ns/op\nBenchmarkGobberSet-8     \t19638064\t        57.3 ns/op\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoway%2Fgobber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoway%2Fgobber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoway%2Fgobber/lists"}