Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yingzhuo/snowflake-golang-client


https://github.com/yingzhuo/snowflake-golang-client

Last synced: 25 days ago
JSON representation

Awesome Lists containing this project

README

        

# snowflake-golang-client

### 安装:

```bash
go get -u github.com/yingzhuo/snowflake-golang-client
```

### 使用例:

```golang
package main

import (
"fmt"

cli "github.com/yingzhuo/snowflake-golang-client"
)

func main() {

client := cli.NewClient(&cli.Config{
Host: "localhost",
Port: 8080,
})

// 生成多个ID
for _, v := range client.NextIds(10) {
fmt.Println(v)
}

// 生成单个ID
fmt.Println(client.NextId())
}
```