1234567891011121314151617181920212223 |
- package main
- import (
- "fmt"
- "github.com/bwmarrin/snowflake"
- )
- func main() {
- // Create a new Node with a Node number of 1
- node, err := snowflake.NewNode(1)
- if err != nil {
- fmt.Println(err)
- return
- }
- // Generate a snowflake ID.
- id := node.Generate()
- json, _ := id.MarshalJSON()
- fmt.Println(string(json))
- }
|