{"id":38065042,"url":"https://github.com/relvacode/go-namespace","last_synced_at":"2026-01-16T20:34:07.578Z","repository":{"id":57541134,"uuid":"71238938","full_name":"relvacode/go-namespace","owner":"relvacode","description":"Namespace access for Go values","archived":false,"fork":false,"pushed_at":"2017-05-23T14:29:40.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T10:03:49.293Z","etag":null,"topics":["access","fields","go","name","namespace","reflect","string","value"],"latest_commit_sha":null,"homepage":"","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/relvacode.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":"2016-10-18T10:56:49.000Z","updated_at":"2018-10-18T01:05:04.000Z","dependencies_parsed_at":"2022-09-17T23:00:42.298Z","dependency_job_id":null,"html_url":"https://github.com/relvacode/go-namespace","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/relvacode/go-namespace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relvacode%2Fgo-namespace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relvacode%2Fgo-namespace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relvacode%2Fgo-namespace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relvacode%2Fgo-namespace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/relvacode","download_url":"https://codeload.github.com/relvacode/go-namespace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/relvacode%2Fgo-namespace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28482267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"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":["access","fields","go","name","namespace","reflect","string","value"],"created_at":"2026-01-16T20:34:07.478Z","updated_at":"2026-01-16T20:34:07.566Z","avatar_url":"https://github.com/relvacode.png","language":"Go","readme":"```go\nimport \"github.com/relvacode/go-namespace\"\n```\n\n[![GoDoc](https://godoc.org/github.com/relvacode/go-namespace?status.svg)](https://godoc.org/github.com/relvacode/go-namespace)\n[![Build Status](https://travis-ci.org/relvacode/go-namespace.svg?branch=master)](https://travis-ci.org/relvacode/go-namespace)\n\nGo namespace provides the ability to get a Go value by a string name. Similar to `text/template`'s value access without templating.\n\n```go\n// l is your value that you want to search its namespace for\n// It can be either a struct or map, or an interface to a struct or map.\nl := map[string]interface{}{\n  \"PrimaryKey\": map[string]interface{}{\n    \"SecondaryKey\": \"MyValue\",\n  },\n}\n\n// Get a value using ordered names.\nv, err = namespace.NameSpace(l, []string{\"PrimaryKey\", \"SecondaryKey\"})\n\nif err != nil {\n  // Do something with the error here\n}\n\nfmt.Println(v.String()) // Outputs: MyValue\n```\n\n### Struct Tags\n\nUsing the `ns` struct tag you can change how namespace will access that struct field.\n\n```go\ntype MyStruct struct {\n        // Ignore this field as a namespace\n        Passthough OtherStruct `ns:'-\"`\n        \n        // Rename the namespace name to 'new'\n        Rename OtherStruct `ns:\"new\"`\n}\n```\n\n### `namespace.Value`\n\n`namespace.Value` is a wrapper around `reflect.Value` that provides safe methods for converting objects into a requested native type.\n\n```go\nv := namespace.ValueOf(1234.567)\ni, err := v.Int()\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelvacode%2Fgo-namespace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frelvacode%2Fgo-namespace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frelvacode%2Fgo-namespace/lists"}