MCPcopy
hub / github.com/segmentio/ksuid / New

Function New

ksuid.go:204–210  ·  view source on GitHub ↗

Generates a new KSUID. In the strange case that random bytes can't be read, it will panic.

()

Source from the content-addressed store, hash-verified

202// Generates a new KSUID. In the strange case that random bytes
203// can't be read, it will panic.
204func 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
213func NewRandom() (ksuid KSUID, err error) {

Callers 15

mainFunction · 0.92
TestEncodeAndDecodeFunction · 0.85
TestMarshalTextFunction · 0.85
TestMarshalBinaryFunction · 0.85
TestMashalJSONFunction · 0.85
TestFlagFunction · 0.85
TestSqlScannerFunction · 0.85
TestSortFunction · 0.85
BenchmarkAppendFunction · 0.85
BenchmarkStringFunction · 0.85
BenchmarkCompareFunction · 0.85

Calls 1

NewRandomFunction · 0.85

Tested by 15

TestEncodeAndDecodeFunction · 0.68
TestMarshalTextFunction · 0.68
TestMarshalBinaryFunction · 0.68
TestMashalJSONFunction · 0.68
TestFlagFunction · 0.68
TestSqlScannerFunction · 0.68
TestSortFunction · 0.68
BenchmarkAppendFunction · 0.68
BenchmarkStringFunction · 0.68
BenchmarkCompareFunction · 0.68
BenchmarkSortFunction · 0.68