{"id":41736451,"url":"https://github.com/esammer/gorange","last_synced_at":"2026-01-25T00:05:35.521Z","repository":{"id":138033446,"uuid":"267217683","full_name":"esammer/gorange","owner":"esammer","description":"A library for representing continuous ranges in Go.","archived":false,"fork":false,"pushed_at":"2020-05-27T17:16:40.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T01:59:12.370Z","etag":null,"topics":["go","golang","library","range"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esammer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-05-27T04:09:06.000Z","updated_at":"2020-05-28T03:57:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"93e02aa7-3a0a-4750-8f23-118dfe27651d","html_url":"https://github.com/esammer/gorange","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/esammer/gorange","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esammer%2Fgorange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esammer%2Fgorange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esammer%2Fgorange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esammer%2Fgorange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esammer","download_url":"https://codeload.github.com/esammer/gorange/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esammer%2Fgorange/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28739333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T22:12:27.248Z","status":"ssl_error","status_checked_at":"2026-01-24T22:12:10.529Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["go","golang","library","range"],"created_at":"2026-01-25T00:05:34.693Z","updated_at":"2026-01-25T00:05:35.504Z","avatar_url":"https://github.com/esammer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gorange\n\n![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/esammer/gorange?label=latest)\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/esammer/gorange/Build)](https://github.com/esammer/gorange/actions?query=workflow%3ABuild)\n\nA continuous value range library for Go.\n\nThis library is suitable for representing continuous ranges of values and performing common operations on those\nranges including order comparison, merging, testing if a value is within a range, and so on. Originally it was\ndeveloped for representing range-encoded values in a column store. This library has no dependencies (beyond its\ntest suite) beyond Go 1.13. Earlier versions of Go may work, but aren't tested.\n\n## Usage\n\nAdd gorange to your project.\n\n    go get github.com/esammer/gorange\n\nCreate a RangeValue implementation.\n\nOr use one of the prebuilt implementations for standard Go types.\n\n    package mypkg\n    \n    import gr \"github.com/esammer/gorange\"\n    \n    type MyValue struct {\n        // ....\n    }\n    \n    // LessThan determines whether one value is less than another. If two values are mutually less than each other\n    // (e.g. !a.LessThan(b) \u0026\u0026 !b.LessThan(a)), they are considered equal.\n    func (v *MyValue) LessThan(other gr.RangeValue) bool {\n        // Some way of determining if v is less than other.\n        return false\n    }\n\nPerform range operations.\n\n    r1 := Range{\n        Begin: IntValue(0),\n        End:   IntValue(10),\n    }\n    r2 := Range{\n        Begin: IntValue(5),\n        End:   IntValue(15),\n    }\n    \n    r1.LessThan(r2)             // true\n    r2.LessThan(r1)             // false\n    r3 := r1.Merge(r2)          // r3: Range{Begin: IntValue(0), End: IntValue(15)}\n    \n    r1.Contains(IntValue(3))    // true\n    r1.Intersects(r2)           // true\n\n## Performance\n\nRange is similar to time.Time in that you should almost always use values rather than pointers to values. A\nrange contains only two interface members. None of the methods on Range allocate memory on the heap. As of\nsha 902c17a, the included benchmarks are as follows.\n\n    esammer@C02C86Q6MD6R range % go test -bench '.*' -benchmem       \n    goos: darwin\n    goarch: amd64\n    pkg: github.com/esammer/gorange\n    BenchmarkRange/LessThan-16        423571209      2.76 ns/op      0 B/op      0 allocs/op\n    BenchmarkRange/Before-16          422689849      2.77 ns/op      0 B/op      0 allocs/op\n    BenchmarkRange/After-16           432240738      2.80 ns/op      0 B/op      0 allocs/op\n    BenchmarkRange/Intersects-16      171612853      6.89 ns/op      0 B/op      0 allocs/op\n    BenchmarkRange/Merge-16           146388944      8.22 ns/op      0 B/op      0 allocs/op\n    BenchmarkRange/Contains-16        100000000     11.0 ns/op       0 B/op      0 allocs/op\n\non a MBP 16\" with the following specs:\n\n    Model Name:                 MacBook Pro\n    Model Identifier:           MacBookPro16,1\n    Processor Name:             8-Core Intel Core i9\n    Processor Speed:            2.4 GHz\n    Number of Processors:       1\n    Total Number of Cores:      8\n    L2 Cache (per Core):        256 KB\n    L3 Cache:                   16 MB\n    Hyper-Threading Technology: Enabled\n    Memory:                     32 GB\n\n    System Version:             macOS 10.15.2 (19C57)\n    Kernel Version:             Darwin 19.2.0\n\n## Documentation\n\nYou can view the gorange API docs at [pkg.go.dev/github.com/esammer/gorange](https://pkg.go.dev/github.com/esammer/gorange).\n\n## Issues\n\nFeel free to file Github issues if you find a bug. PRs are welcome.\n\n## License\n\nThis software is licensed under the Apache License 2.0.\n\nCopyright 2020, Eric Sammer.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesammer%2Fgorange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesammer%2Fgorange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesammer%2Fgorange/lists"}