{"id":20695434,"url":"https://github.com/jetify-com/typeid-go","last_synced_at":"2025-04-05T18:06:01.930Z","repository":{"id":177160598,"uuid":"650812956","full_name":"jetify-com/typeid-go","owner":"jetify-com","description":"Go implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs","archived":false,"fork":false,"pushed_at":"2025-03-06T20:24:53.000Z","size":70,"stargazers_count":145,"open_issues_count":3,"forks_count":6,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-29T17:05:38.859Z","etag":null,"topics":["go","golang","guid","typeid","uuid","uuidv7"],"latest_commit_sha":null,"homepage":"","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/jetify-com.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2023-06-07T21:36:32.000Z","updated_at":"2025-03-25T07:04:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"9acb665b-9f78-40b4-8260-8c313e4bfd1f","html_url":"https://github.com/jetify-com/typeid-go","commit_stats":null,"previous_names":["jetpack-io/typeid-go","jetify-com/typeid-go"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetify-com%2Ftypeid-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetify-com%2Ftypeid-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetify-com%2Ftypeid-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetify-com%2Ftypeid-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jetify-com","download_url":"https://codeload.github.com/jetify-com/typeid-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247378140,"owners_count":20929296,"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","guid","typeid","uuid","uuidv7"],"created_at":"2024-11-17T00:09:25.391Z","updated_at":"2025-04-05T18:06:01.884Z","avatar_url":"https://github.com/jetify-com.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# TypeID Go\n\n### A golang implementation of [TypeIDs](https://github.com/jetify-com/typeid)\n\n![License: Apache 2.0](https://img.shields.io/github/license/jetify-com/typeid-go) [![Go Reference](https://pkg.go.dev/badge/go.jetify.com/typeid.svg)](https://pkg.go.dev/go.jetify.com/typeid)\n\nTypeIDs are a modern, **type-safe**, globally unique identifier based on the upcoming\nUUIDv7 standard. They provide a ton of nice properties that make them a great choice\nas the primary identifiers for your data in a database, APIs, and distributed systems.\nRead more about TypeIDs in their [spec](https://github.com/jetify-com/typeid).\n\nThis particular implementation provides a go library for generating and parsing TypeIDs.\n\n## Installation\n\nTo add this library as a dependency in your go module, run:\n\n```bash\ngo get go.jetify.com/typeid\n```\n\n## Usage\n\nThis library provides a go implementation of TypeID that allows you\nto define your own custom id types for added compile-time safety.\n\nIf you don't need compile-time safety, you can use the provided `typeid.AnyID` directly:\n\n```go\nimport (\n  \"go.jetify.com/typeid\"\n)\n\nfunc example() {\n  tid, _ := typeid.WithPrefix(\"user\")\n  fmt.Println(tid)\n}\n```\n\nIf you want compile-time safety, define your own custom types with two steps:\n\n1. Define a struct the implements the method `Prefix`. Prefix should return the\n   string that should be used as the prefix for your custom type.\n2. Define you own id type, by embedding `typeid.TypeID[CustomPrefix]`\n\nFor example to define a UserID with prefix `user`:\n\n```go\nimport (\n  \"go.jetify.com/typeid\"\n)\n\n// Define the prefix:\ntype UserPrefix struct {}\nfunc (UserPrefix) Prefix() string { return \"user\" }\n\n// Define UserID:\ntype UserID struct {\n\ttypeid.TypeID[UserPrefix]\n}\n```\n\nNow you can use the UserID type to generate new ids:\n\n```go\nimport (\n  \"go.jetify.com/typeid\"\n)\n\nfunc example() {\n  tid, _ := typeid.New[UserID]()\n  fmt.Println(tid)\n}\n```\n\nFor the full documentation, see this package's [godoc](https://pkg.go.dev/go.jetify.com/typeid).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetify-com%2Ftypeid-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjetify-com%2Ftypeid-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetify-com%2Ftypeid-go/lists"}