{"id":49073267,"url":"https://github.com/kitstack/structkit","last_synced_at":"2026-04-20T08:12:46.945Z","repository":{"id":63276535,"uuid":"566130844","full_name":"kitstack/structkit","owner":"kitstack","description":"StructKit is a simple tool that allows you to copy specific fields from a new struct and retrieve values from a struct or slice","archived":false,"fork":false,"pushed_at":"2023-04-20T02:08:04.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T17:47:31.032Z","etag":null,"topics":["copy","coverage","extractor","get","go","golang","golang-library","simple","struct","tag"],"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/kitstack.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}},"created_at":"2022-11-15T02:50:23.000Z","updated_at":"2023-04-14T18:07:19.000Z","dependencies_parsed_at":"2024-02-12T02:02:38.334Z","dependency_job_id":null,"html_url":"https://github.com/kitstack/structkit","commit_stats":null,"previous_names":["lab210-dev/structkit","lab210-dev/structator","jackgianesini/structkit","kitstack/structkit"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/kitstack/structkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fstructkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fstructkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fstructkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fstructkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitstack","download_url":"https://codeload.github.com/kitstack/structkit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fstructkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32038608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["copy","coverage","extractor","get","go","golang","golang-library","simple","struct","tag"],"created_at":"2026-04-20T08:12:46.477Z","updated_at":"2026-04-20T08:12:46.936Z","avatar_url":"https://github.com/kitstack.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go](https://github.com/kitstack/structkit/actions/workflows/coverage.yml/badge.svg)](https://github.com/kitstack/structkit/actions/workflows/coverage.yml)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/kitstack/structkit)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kitstack/structkit)](https://goreportcard.com/report/github.com/kitstack/structkit)\n[![codecov](https://codecov.io/gh/kitstack/structkit/branch/main/graph/badge.svg?token=3JRL5ZLSIH)](https://codecov.io/gh/kitstack/structkit)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kitstack/structkit/blob/main/LICENSE)\n[![Github tag](https://badgen.net/github/release/kitstack/structkit)](https://github.com/kitstack/structkit/releases)\n\n# 🚀 Overview\n\nStructKit is simple tool for : \n\n- [x] Copy specific fields a new struct.\n  - Tag copy \n- [x] Get value of specific field.\n    - Slice\n    - Struct\n    - Pointer\n- [x] Set value of specific field.\n    - Slice (Append, Replace or Update)\n    - Struct\n    - Pointer\n- [x] Coverage\n    - 100% tested code 🤓\n- [x] Benchmark\n    - Get (Optimized with cache)\n\n\n### Copy\n\n```go\npackage main\n\nimport (\n    \"github.com/kitstack/structkit\"\n    \"log\"\n)\n\ntype Foo struct {\n    Counter int    `json:\"int\"`\n    Value   string `json:\"value\"`\n    Struct  Bar    `json:\"struct\"`\n    Slice   []Bar  `json:\"Slice\"`\n}\n\ntype Bar struct {\n    Value string `json:\"value\"`\n}\n\nfunc main() {\n    payload := Foo{Value: \"foo\", Struct: Bar{Value: \"bar\"}}\n    log.Printf(\"%v\", structkit.Copy(payload, \"Value\", \"Struct.Value\")) // {foo {bar}}\n}\n```\n\n### Get\n\n```go\npackage main\n\nimport (\n    \"github.com/kitstack/structkit\"\n    \"log\"\n)\n\ntype Foo struct {\n    Counter int    `json:\"int\"`\n    Value   string `json:\"value\"`\n    Struct  Bar    `json:\"struct\"`\n    Slice   []Bar  `json:\"Slice\"`\n}\n\ntype Bar struct {\n    Value string `json:\"value\"`\n}\n\nfunc main() {\n    payload := Foo{Value: \"foo\", Struct: Bar{Value: \"bar\"}, Slice: []Bar{{Value: \"baz\"}}}\n\t\n    log.Printf(\"%v\", structkit.Get(payload, \"Value\")) // foo\n    log.Printf(\"%v\", structkit.Get(payload, \"Struct/Value\", \u0026structkit.Option{Delimiter: \"/\"})) // bar\n    log.Printf(\"%v\", structkit.Get(payload, \"Slice.[0].Value\")) // baz\n}\n```\n\n\n### Set\n\n```go\npackage main\n\nimport (\n    \"github.com/kitstack/structkit\"\n    \"log\"\n)\n\ntype Foo struct {\n    Value   string\n    Struct  Bar\n    StructP *Bar\n    Slice   []Bar\n}\n\ntype Bar struct {\n    Value string\n}\n\nfunc main() {\n    payload := Foo{}\n  \n    err := structkit.Set(\u0026payload, \"Value\", \"foo\")\n    if err != nil {\n      panic(err)\n    }\n    log.Print(payload.Value) // foo\n  \n    err = structkit.Set(\u0026payload, \"Struct.Value\", \"bar\")\n    if err != nil {\n      panic(err)\n    }\n    log.Print(payload.Struct.Value) // bar\n  \n    err = structkit.Set(\u0026payload, \"StructP.Value\", \"bar\")\n    if err != nil {\n      panic(err)\n    }\n    log.Print(payload.StructP.Value) // bar\n  \n    err = structkit.Set(\u0026payload, \"Slice.[*]\", Bar{Value: \"bar\"})\n    if err != nil {\n      panic(err)\n    }\n    log.Print(payload.Slice) // [{bar}]\n  \n    err = structkit.Set(\u0026payload, \"Slice.[0].Value\", \"bar updated\")\n    if err != nil {\n      panic(err)\n    }\n    log.Print(payload.Slice) // [{bar updated}]\n}\n\n```\n\n\n### 💪 Benchmark\n\n```bash\ngoos: darwin\ngoarch: arm64\npkg: github.com/kitstack/structkit\nBenchmarkGet\nBenchmarkGet-10                      \t 6346312\t       194.0 ns/op\nBenchmarkGetEmbeddedValue\nBenchmarkGetEmbeddedValue-10         \t 5543814\t       209.5 ns/op\nBenchmarkGetEmbeddedSliceValue\nBenchmarkGetEmbeddedSliceValue-10    \t 4526838\t       262.4 ns/op\n```\n\n## 🤝 Contributions\nContributors to the package are encouraged to help improve the code.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitstack%2Fstructkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitstack%2Fstructkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitstack%2Fstructkit/lists"}