{"id":20193923,"url":"https://github.com/rocicorp/fracdex","last_synced_at":"2025-04-10T09:53:55.960Z","repository":{"id":45060222,"uuid":"312955413","full_name":"rocicorp/fracdex","owner":"rocicorp","description":"Fractional indexing in Golang","archived":false,"fork":false,"pushed_at":"2024-12-11T17:55:10.000Z","size":22,"stargazers_count":33,"open_issues_count":1,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-24T08:47:56.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rocicorp.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,"publiccode":null,"codemeta":null}},"created_at":"2020-11-15T04:10:42.000Z","updated_at":"2025-02-11T01:51:09.000Z","dependencies_parsed_at":"2024-06-19T03:04:37.390Z","dependency_job_id":"91fb7cf1-7ce3-48c1-a48f-67a90d0d3bd6","html_url":"https://github.com/rocicorp/fracdex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocicorp%2Ffracdex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocicorp%2Ffracdex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocicorp%2Ffracdex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocicorp%2Ffracdex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rocicorp","download_url":"https://codeload.github.com/rocicorp/fracdex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198503,"owners_count":21063626,"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":[],"created_at":"2024-11-14T04:01:50.584Z","updated_at":"2025-04-10T09:53:55.906Z","avatar_url":"https://github.com/rocicorp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fractional Indexing\n\nThis is based on [Implementing Fractional Indexing\n](https://observablehq.com/@dgreensp/implementing-fractional-indexing) by [David Greenspan\n](https://github.com/dgreensp).\n\nFractional indexing is a technique to create an ordering that can be used for [Realtime Editing of Ordered Sequences](https://www.figma.com/blog/realtime-editing-of-ordered-sequences/).\n\nThis implementation includes variable-length integers, and the prepend/append optimization described in David's article.\n\nThis should be byte-for-byte compatible with https://github.com/rocicorp/fractional-indexing.\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"roci.dev/fracdex\"\n)\n\nfunc main() {\n\tfirst, _ := fracdex.KeyBetween(\"\", \"\") // a0\n\tfmt.Println(first)\n\n\t// Insert after 1st\n\tsecond, _ := fracdex.KeyBetween(first, \"\") // \"a1\"\n\tfmt.Println(second)\n\n\t// Insert after 2nd\n\tthird, _ := fracdex.KeyBetween(second, \"\") // \"a2\"\n\tfmt.Println(third)\n\n\t// Insert before 1st\n\tzeroth, _ := fracdex.KeyBetween(\"\", first) // \"Zz\"\n\tfmt.Println(zeroth)\n\n\t// Insert in between 2nd and 3rd\n\tsecondAndHalf, _ := fracdex.KeyBetween(second, third) // \"a1V\"\n\tfmt.Println(secondAndHalf)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocicorp%2Ffracdex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocicorp%2Ffracdex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocicorp%2Ffracdex/lists"}