Example #1
0
func TestBase62KSortability(t *testing.T) {
	if testing.Short() {
		t.Skip("Skipping base62 k-ordering tests")
	}

	// Use a custom encoder so we can set the padding
	e := base62.NewStdEncoding().Option(base62.Padding(25))

	ksortability(t, func(id *BigflakeId) string {
		return e.EncodeBigInt(id.Raw())
	})
}
Example #2
0
File: id.go Project: leibowitz/kala
// Base62WithPadding returns a base62 encoded id with left padding
func (bf *BigflakeId) Base62WithPadding(minlen int) string {
	e := base62.NewStdEncoding().Option(base62.Padding(minlen))

	return e.EncodeBigInt(bf.id)
}