Generates a new KSUID. In the strange case that random bytes can't be read, it will panic.
()
| 202 | // Generates a new KSUID. In the strange case that random bytes |
| 203 | // can't be read, it will panic. |
| 204 | func New() KSUID { |
| 205 | ksuid, err := NewRandom() |
| 206 | if err != nil { |
| 207 | panic(fmt.Sprintf("Couldn't generate KSUID, inconceivable! error: %v", err)) |
| 208 | } |
| 209 | return ksuid |
| 210 | } |
| 211 | |
| 212 | // Generates a new KSUID |
| 213 | func NewRandom() (ksuid KSUID, err error) { |