Iceflake
iceflake is a Unique ID generator using 'snowflake' algorithm.
Install / Use
/learn @istyle-inc/IceflakeREADME
iceflake
What is This
iceflake is a Unique ID generator using 'snowflake' algorithm. connect using unix domain socket(we might implement tcp connection mode optionally, also, someday), data are transferred using Protocol Buffer.
Usage
IceFlake Server
You can download from release page or go get -u github.com/istyle-inc/iceflake
$ iceflake -w 1 -s YOUR_SOCKET_FILE_PATH
"YOUR_SOCKET_FILE_PATH" here, is to be an absolute path.
IceFlake Client
Also you can use through this package. So, execute
go get -u github.com/istyle-inc/iceflake/...
and here's a client code example
client := iceflake.NewClient("unix", "YOUR_SOCKET_FILE_PATH")
flake, err := client.Get()
if err != nil {
logger.Error("Error: Failed connect socket or get data: ", err)
}
fmt.Println(flake.GetId())
You can access "Id" on result struct, but more safety to access through GetId() func, which return zero value when receiver is nil.
License
Author
Related Skills
feishu-drive
345.9k|
things-mac
345.9kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
345.9kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
postkit
PostgreSQL-native identity, configuration, metering, and job queues. SQL functions that work with any language or driver
