{"id":21121427,"url":"https://github.com/oneofone/radix","last_synced_at":"2025-07-08T21:32:45.863Z","repository":{"id":57615711,"uuid":"382768878","full_name":"OneOfOne/radix","owner":"OneOfOne","description":"radix: a go radix tree with nearest matching","archived":false,"fork":false,"pushed_at":"2021-07-16T22:34:50.000Z","size":103,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T11:25:15.901Z","etag":null,"topics":["go","golang","radix-tree"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/go.oneofone.dev/radix@main","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OneOfOne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"OneOfOne"}},"created_at":"2021-07-04T05:16:14.000Z","updated_at":"2022-02-06T08:27:26.000Z","dependencies_parsed_at":"2022-09-13T15:52:06.250Z","dependency_job_id":null,"html_url":"https://github.com/OneOfOne/radix","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/OneOfOne/radix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fradix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fradix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fradix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fradix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OneOfOne","download_url":"https://codeload.github.com/OneOfOne/radix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneOfOne%2Fradix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264352885,"owners_count":23594987,"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":["go","golang","radix-tree"],"created_at":"2024-11-20T03:50:17.175Z","updated_at":"2025-07-08T21:32:43.559Z","avatar_url":"https://github.com/OneOfOne.png","language":"Go","readme":"# radix\n[![Go Reference](https://pkg.go.dev/badge/go.oneofone.dev/radix.svg)](https://pkg.go.dev/go.oneofone.dev/radix)\n![test status](https://github.com/OneOfOne/radix/actions/workflows/test.yml/badge.svg)\n[![Coverall](https://coveralls.io/repos/github/OneOfOne/radix/badge.svg?branch=main)](https://coveralls.io/github/OneOfOne/radix)\n\nImplements a [radix tree](http://en.wikipedia.org/wiki/Radix_tree), optimized for sparse nodes.\n\nThis is a hard-fork based of [armon/go-radix](https://github.com/armon/go-radix), with some additions.\n\n# Features\n\n* O(k) operations. In many cases, this can be faster than a hash table since the hash function is an O(k) operation, and hash tables have very poor cache locality.\n* Minimum / Maximum value lookups\n* Ordered iteration\n\n## New\n* Can walk the tree from the nearest path\n* Includes a thread-safe version.\n* Unicode safe.\n* Case-insensitive matching support.\n* Go Generics support.\n\n# TODO\n\n* Marshaling/Unmarshaling support (currently you can dump to json).\n* More optimizations.\n* More benchmarks.\n\n# Usage\n\n```go\n// go get go.oneofone.dev/radix@main\n// Create a case-insensistive tree\nr := radix.New[int](true)\n\n// or thread-safe version\n// t := NewSafe[int](true)\nt.Set(\"foo\", 1)\nt.Set(\"bar\", 2)\nt.Set(\"foobar\", 2)\n\n// Find the longest prefix match\nm, _, _ := t.LongestPrefix(\"fOoZiP\")\nif m != \"foo\" {\n    panic(\"should be foo\")\n}\n```\n\n### Generating a typed version for go \u003c 1.18 (requires perl and posix shell)\n\n```sh\n# outside a module\n$ go get go.oneofone.dev/radix\n$ sh $(go env GOPATH)/src/go.oneofone.dev/radix/gen.sh \"interface{}\" # or \"string\" or \"[]pkg.SomeStruct\"\n```\n\n# Using the generic version\n\nInstall Go 1.18 (\u003csmall\u003e[dev.typeparams](https://github.com/golang/go/tree/dev.typeparams)\u003c/small\u003e)\n\n```sh\n$ go get golang.org/dl/gotip\n$ gotip download dev.typeparams\n$ gotip get go.oneofone.dev/radix@main # note that the go proxy does not support go 1.18 yet.\n```\n\n# Contributions\n\nAnyone is more than welcome to open pull requests provided they adhere to the Go community [code of conduct](https://golang.org/conduct).\n\nIt's recommended that any modifications should be on the [generic](radix.go),\nhowever if that's not possible, I'll port any changes from the [compact](radix_go117.go).\n\n# License\n\n[MIT](LICENSE)\n","funding_links":["https://github.com/sponsors/OneOfOne"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneofone%2Fradix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foneofone%2Fradix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foneofone%2Fradix/lists"}