{"id":49351462,"url":"https://github.com/nhas/tetcd","last_synced_at":"2026-04-27T10:03:28.049Z","repository":{"id":351264111,"uuid":"1210234404","full_name":"NHAS/tetcd","owner":"NHAS","description":"A typesafe harness for etcd","archived":false,"fork":false,"pushed_at":"2026-04-21T15:01:50.000Z","size":84,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-21T16:42:06.958Z","etag":null,"topics":["etcd","typesafety","wag"],"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/NHAS.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-14T08:02:13.000Z","updated_at":"2026-04-21T15:01:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/NHAS/tetcd","commit_stats":null,"previous_names":["nhas/tetcd"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/NHAS/tetcd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Ftetcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Ftetcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Ftetcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Ftetcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NHAS","download_url":"https://codeload.github.com/NHAS/tetcd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHAS%2Ftetcd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32331306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":["etcd","typesafety","wag"],"created_at":"2026-04-27T10:03:10.480Z","updated_at":"2026-04-27T10:03:28.019Z","avatar_url":"https://github.com/NHAS.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typesafe Etcd\n\nThis project combines code-generation and generics to hopefully provide a fairly usable typesafe harness for the KV store etcd. \nIt generates both the path to your values, based on the struct you pass it when generating, and determines the types.\n\n## Example\n\n\nFor example, you have your configuration/database layout.\n\n```go\npackage config\n\ntype ServerConfig struct {\n\tHost string\n\tPort int\n}\n\ntype TLSConfig struct {\n\tCertFile string\n\tKeyFile  string\n}\n\ntype Config struct {\n\tServer ServerConfig\n\tTLS    TLSConfig\n\n\tName   string\n\tLabels map[string]string\n\tTags   []string `tetcd:\"compress\"`\n\n\t// should be skipped\n\tignored      string\n\tSkippedField string `tetcd:\"-\"`\n}\n\n```\n\nThen in another file in your project:\n```go\n//go:generate go run github.com/NHAS/tetcd/cmd/tetcd-gen -type=github.com/NHAS/tetcd/cmd/test/config.Config -out=config_etcd.go \n```\n\n```go\n// Code generated by https://github.com/NHAS/tetcd, DO NOT EDIT.\npackage main\n\nimport (\n\tcodecs \"github.com/NHAS/tetcd/codecs\"\n\tpaths \"github.com/NHAS/tetcd/paths\"\n)\n\ntype autoTypeConfigServer struct{}\n\n// Host() KV should contain type string\nfunc (autoTypeConfigServer) Host() paths.Path[string] {\n\treturn paths.NewPath(\"wagtest/Config/Server/Host\", codecs.NewJsonCodec[string]())\n}\n\n// Port() KV should contain type int\nfunc (autoTypeConfigServer) Port() paths.Path[int] {\n\treturn paths.NewPath(\"wagtest/Config/Server/Port\", codecs.NewJsonCodec[int]())\n}\n\ntype autoTypeConfigTLS struct{}\n\n// CertFile() KV should contain type string\nfunc (autoTypeConfigTLS) CertFile() paths.Path[string] {\n\treturn paths.NewPath(\"wagtest/Config/TLS/CertFile\", codecs.NewJsonCodec[string]())\n}\n\n// KeyFile() KV should contain type string\nfunc (autoTypeConfigTLS) KeyFile() paths.Path[string] {\n\treturn paths.NewPath(\"wagtest/Config/TLS/KeyFile\", codecs.NewJsonCodec[string]())\n}\n\ntype autoTypeConfig struct {\n\tServer autoTypeConfigServer\n\tTLS    autoTypeConfigTLS\n}\n\n// Labels() is a map path with prefix wagtest/Config/Labels, value type string\nfunc (autoTypeConfig) Labels() paths.MapPath[string] {\n\treturn paths.NewMapPath(\"wagtest/Config/Labels\", codecs.NewJsonCodec[string]())\n}\n\n// Name() KV should contain type string\nfunc (autoTypeConfig) Name() paths.Path[string] {\n\treturn paths.NewPath(\"wagtest/Config/Name\", codecs.NewJsonCodec[string]())\n}\n\n// Tags() KV should contain type []string\nfunc (autoTypeConfig) Tags() paths.Path[[]string] {\n\treturn paths.NewPath(\"wagtest/Config/Tags\", codecs.NewJsonCodec[[]string]())\n}\n\nvar Config = autoTypeConfig{}\n```\n\nThen you can use it like this:\n\n```go\nfunc UpdateLabels(labelName, contents string) error {\n   \treturn Config.Labels().Key(labelName).Put(context.Background(), etcdclient, contents)\n}\n```\n\n## Configuration\n\n### `generate`\n\n| Flag | Default | Description |\n|---|---|---|\n| `-prefix` | `\"\"` | The global etcd key prefix |\n| `-type` | `\"\"` | Fully qualified type to analyse, e.g. `github.com/some/pkg.Config` (required) |\n| `-pkg` | `$GOPACKAGE` | Output package name |\n| `-out` | `\u003ctype\u003e_gen.go` | Output file path |\n\n### Struct tags\n\nThe generator supports two tag options:\n\n`tetcd:\"compress\"`: Store value of slices/maps as value on a key rather than as keys under a prefix\n`tetcd:\"-\"`: Ignore this struct field\n\n## Used\n\nhttps://github.com/NHAS/wag","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhas%2Ftetcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhas%2Ftetcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhas%2Ftetcd/lists"}