{"id":13786657,"url":"https://github.com/btnguyen2k/olaf","last_synced_at":"2026-02-20T10:31:45.367Z","repository":{"id":57496512,"uuid":"163976908","full_name":"btnguyen2k/olaf","owner":"btnguyen2k","description":"Twitter Snowflake implemented in Go","archived":false,"fork":false,"pushed_at":"2019-04-10T08:59:20.000Z","size":30,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-11T22:38:54.441Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/btnguyen2k.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}},"created_at":"2019-01-03T13:31:10.000Z","updated_at":"2024-11-06T11:54:49.000Z","dependencies_parsed_at":"2022-08-28T11:50:48.649Z","dependency_job_id":null,"html_url":"https://github.com/btnguyen2k/olaf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/btnguyen2k/olaf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btnguyen2k%2Folaf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btnguyen2k%2Folaf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btnguyen2k%2Folaf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btnguyen2k%2Folaf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btnguyen2k","download_url":"https://codeload.github.com/btnguyen2k/olaf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btnguyen2k%2Folaf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29647894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"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":[],"created_at":"2024-08-03T19:01:27.287Z","updated_at":"2026-02-20T10:31:45.351Z","avatar_url":"https://github.com/btnguyen2k.png","language":"Go","funding_links":[],"categories":["Utilities","公用事业公司","工具库","Utility","工具库`可以提升效率的通用代码库和工具`"],"sub_categories":["Utility/Miscellaneous","实用程序/Miscellaneous","HTTP Clients","查询语","Fail injection"],"readme":"**Since 10-Apr-2019: Olaf has been merged as a sub-module of [btnguyen2k/consu](https://github.com/btnguyen2k/consu)**\n\n# Olaf\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/btnguyen2k/olaf)](https://goreportcard.com/report/github.com/btnguyen2k/olaf)\n[![cover.run](https://cover.run/go/github.com/btnguyen2k/olaf.svg?style=flat\u0026tag=golang-1.10)](https://cover.run/go?tag=golang-1.10\u0026repo=github.com%2Fbtnguyen2k%2Folaf)\n[![GoDoc](https://godoc.org/github.com/btnguyen2k/olaf?status.svg)](https://godoc.org/github.com/btnguyen2k/olaf)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n\nGolang implementation of Twitter Snowflake.\n\n## Getting Started\n\n### Install Package\n\n```\ngo get github.com/btnguyen2k/olaf\n```\n\n### Usage\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/btnguyen2k/olaf\"\n)\n\nfunc main() {\n    // use default epoch\n    o := olaf.NewOlaf(1981)\n\n    //use custom epoch (note: epoch is in milliseconds)\n    //o := olaf.NewOlafWithEpoch(103, 1546543604123)\n\n    id64 := o.Id64()\n    id64Hex := o.Id64Hex()\n    id64Ascii := o.Id64Ascii()\n    fmt.Println(\"ID 64-bit (int)   : \", id64, \" / Timestamp: \", o.ExtractTime64(id64))\n    fmt.Println(\"ID 64-bit (hex)   : \", id64Hex, \" / Timestamp: \", o.ExtractTime64Hex(id64Hex))\n    fmt.Println(\"ID 64-bit (ascii) : \", id64Ascii, \" / Timestamp: \", o.ExtractTime64Ascii(id64Ascii))\n\n    id128 := o.Id128()\n    id128Hex := o.Id128Hex()\n    id128Ascii := o.Id128Ascii()\n    fmt.Println(\"ID 128-bit (int)  : \", id128.String(), \" / Timestamp: \", o.ExtractTime128(id128))\n    fmt.Println(\"ID 128-bit (hex)  : \", id128Hex, \" / Timestamp: \", o.ExtractTime128Hex(id128Hex))\n    fmt.Println(\"ID 128-bit (ascii): \", id128Ascii, \" / Timestamp: \", o.ExtractTime128Ascii(id128Ascii))\n}\n```\n\n## Document - GoDoc\n\nSee [GoDoc](https://godoc.org/github.com/btnguyen2k/olaf).\n\n\n## History\n\nCurrent version: `0.1.0`.\n\n### 2019-01-03 - v0.1.0\n\nFirst release:\n\n- Generate 64-bit and 128-bit IDs:\n  - Support formats: `integer`, `hex-string` (base 16) and `ascii-string` (base 36).\n  - Custom epoch (64-bit ID only).\n- Extract the time metadata from generated ID.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtnguyen2k%2Folaf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtnguyen2k%2Folaf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtnguyen2k%2Folaf/lists"}