Fixed readme example.
This commit is contained in:
parent
cd8e42350a
commit
d80550bec3
@ -54,11 +54,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate a snowflake ID.
|
// Generate a snowflake ID.
|
||||||
id, err := node.Generate()
|
id := node.Generate()
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print out the ID in a few different ways.
|
// Print out the ID in a few different ways.
|
||||||
fmt.Printf("Int64 ID: %d\n", id)
|
fmt.Printf("Int64 ID: %d\n", id)
|
||||||
@ -74,6 +70,9 @@ func main() {
|
|||||||
|
|
||||||
// Print out the ID's sequence number
|
// Print out the ID's sequence number
|
||||||
fmt.Printf("ID Step : %d\n", id.Step())
|
fmt.Printf("ID Step : %d\n", id.Step())
|
||||||
|
|
||||||
|
// Generate and print, all in one.
|
||||||
|
fmt.Printf("ID : %d\n", node.Generate().Int64())
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user