{"id":18030528,"url":"https://github.com/stokito/go-idnum","last_synced_at":"2025-04-04T21:16:38.502Z","repository":{"id":170255061,"uuid":"646386586","full_name":"stokito/go-idnum","owner":"stokito","description":"I simple struct with pair of integer and it's string representation.","archived":false,"fork":false,"pushed_at":"2023-09-08T05:54:54.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T13:07:11.096Z","etag":null,"topics":["golang","zero-allocation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stokito.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-05-28T08:23:19.000Z","updated_at":"2023-05-28T08:44:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"ae002c3e-ae92-4b24-9e78-d4fbcaf11afe","html_url":"https://github.com/stokito/go-idnum","commit_stats":null,"previous_names":["stokito/go-idnum"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stokito%2Fgo-idnum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stokito%2Fgo-idnum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stokito%2Fgo-idnum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stokito%2Fgo-idnum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stokito","download_url":"https://codeload.github.com/stokito/go-idnum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249544,"owners_count":20908212,"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":["golang","zero-allocation"],"created_at":"2024-10-30T09:14:30.235Z","updated_at":"2025-04-04T21:16:38.477Z","avatar_url":"https://github.com/stokito.png","language":"Go","readme":"# go-idnum Numeric ID struct\n\nIf you have some id or integer used on a program then you'll waste some memory and CPU for conversions to string and from string.\nInstead you can create the IdNum struct that is just a pair of integer and it's string.\nThen you can call multiple times it's String() method without any new allocations.\nThe type supports JSON serialization and deserialization\n\n## Usage\n\n```go\nidNum1 := NewIdNum(42)\nidNum2 := NewIdNumFromStr(\"42\")\nidNum3 := NewIdNumFromBytes([]byte(\"42\"))\n\nidNum1.Num == 42\nidNum1.Str == \"42\"\nidNum1.String() == \"42\"\n\n// You can use as a field type in DTO\ntype User struct {\n    Id IdNum\n}\n\nbody, err := json.Marshal(u)\nbody == `{\"Id\":42}`\n```\n\n## Install\n\n    go get -u github.com/stokito/go-idnum\n\n\n## License\n\n[0BSD](https://opensource.org/licenses/0BSD) (similar to Public Domain)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstokito%2Fgo-idnum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstokito%2Fgo-idnum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstokito%2Fgo-idnum/lists"}