{"id":31771284,"url":"https://github.com/bkircher/pg_base62","last_synced_at":"2026-05-15T18:34:14.862Z","repository":{"id":317675380,"uuid":"961133186","full_name":"bkircher/pg_base62","owner":"bkircher","description":"A PostgreSQL extension for encoding and decoding UUID to Base62","archived":false,"fork":false,"pushed_at":"2025-10-02T09:42:02.000Z","size":10,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-02T11:30:30.562Z","etag":null,"topics":["base62","postgresql","uuidv7"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bkircher.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-04-05T20:30:44.000Z","updated_at":"2025-10-02T09:42:05.000Z","dependencies_parsed_at":"2025-10-02T11:30:32.779Z","dependency_job_id":"af319c67-c2aa-4101-b3d4-054b82ccea3e","html_url":"https://github.com/bkircher/pg_base62","commit_stats":null,"previous_names":["bkircher/pg_base62"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bkircher/pg_base62","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkircher%2Fpg_base62","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkircher%2Fpg_base62/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkircher%2Fpg_base62/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkircher%2Fpg_base62/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bkircher","download_url":"https://codeload.github.com/bkircher/pg_base62/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkircher%2Fpg_base62/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002634,"owners_count":26083425,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"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":["base62","postgresql","uuidv7"],"created_at":"2025-10-10T03:26:11.646Z","updated_at":"2026-05-15T18:34:14.856Z","avatar_url":"https://github.com/bkircher.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg_base62\n\nA PostgreSQL extension for encoding UUIDs to Base62 alphabet and decoding Base62\nback to UUID. It is built in Rust with\n[pgrx](https://github.com/pgcentralfoundation/pgrx).\n\n## Overview\n\nThis extension provides functions to convert PostgreSQL UUIDs to and from Base62\nencoded strings. Base62 encoding uses alphanumeric characters (0-9, A-Z, a-z) to\ncreate shorter, URL-safe representations of UUIDs.\n\nIt provides two functions:\n\n- `base62_encode(uuid) → text`\n- `base62_decode(text) → uuid`\n\n## Usage\n\n### Functions\n\n#### `base62_encode(uuid) → text`\n\nEncodes a UUID into a Base62 string representation.\n\n**Parameters:**\n\n- `uuid`: A PostgreSQL UUID value\n\n**Returns:**\n\n- `text`: The Base62 encoded representation as a URL-safe string\n\n**Example:**\n\n```sql\nSELECT base62_encode('f81d4fae-7dec-11d0-a765-00a0c91e6bf6'::uuid);\n```\n\n#### `base62_decode(text) → uuid`\n\nDecodes a Base62 encoded string back to a UUID.\n\n**Parameters:**\n\n- `text`: Base62 encoded representation created by `base62_encode`\n\n**Returns:**\n\n- `uuid`: The decoded UUID value\n\n## Installation\n\n### Prerequisites\n\n- PostgreSQL 18 or later (Note: theoretically this can be everything from\n  PostgreSQL 14 upwards. I just didn't test this)\n- Rust toolchain\n- pgrx development tools\n\n### Build and Install\n\n```bash\n# Install pgrx if not already installed\ncargo install --locked cargo-pgrx --version 0.17.0\n\n# Initialize pgrx for your PostgreSQL version\ncargo pgrx init\n\n# Build and install the extension\ncargo pgrx install\n```\n\n### Enable the Extension\n\n```sql\ncreate extension pg_base62;\n```\n\nUse it like this:\n\n```raw\nselect base62_encode('0199a3e9-85b2-764a-8ff0-a1fcd5f9a3b2'::uuid);\n     base62_encode\n───────────────────────\n 31CmN3LMJd6n2qPHOlsuY\n(1 row)\n\nselect base62_decode('31CmN3LMJd6n2qPHOlsuY');\n            base62_decode\n──────────────────────────────────────\n 0199a3e9-85b2-764a-8ff0-a1fcd5f9a3b2\n(1 row)\n```\n\n## Development\n\n### Running Tests\n\n```bash\n# Run Rust unit tests\ncargo test\n\n# Run PostgreSQL integration tests\ncargo pgrx test\n```\n\n### Project Structure\n\n- `src/lib.rs` - Main extension code with encoding functions\n- `src/error.rs` - Custom error types\n- `src/bin/pgrx_embed.rs` - pgrx embedding binary\n- `pg_base62.control` - PostgreSQL extension control file\n\n## Technical Details\n\n- **Base62 Character Set**:\n  `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`\n- **UUID Representation**: UUIDs are converted to 128-bit integers before\n  encoding\n- **Output Length**: Base62 encoded UUIDs are up to 22 characters long (to be\n  precise: $\\log_{62}(2^{128})$)\n\n## License\n\nMIT License - see the repository for full license text.\n\n## Links\n\n- [Base62 Wikipedia](https://en.wikipedia.org/wiki/Base62)\n- [pgrx Framework](https://github.com/pgcentralfoundation/pgrx)\n- [PostgreSQL Extensions](https://www.postgresql.org/docs/18/extend.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkircher%2Fpg_base62","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkircher%2Fpg_base62","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkircher%2Fpg_base62/lists"}