@@ -23,23 +23,36 @@ func main() {
2323 h := hashids.NewWithData (hd)
2424 e , _ := h.Encode ([]int {45 , 434 , 1313 , 99 })
2525 fmt.Println (e)
26- d := h.Decode (e)
26+ d , _ := h.DecodeWithError (e)
2727 fmt.Println (d)
2828}
2929```
3030
3131### Test results
3232
3333```
34- === RUN TestEncryptDecrypt
35- --- PASS: TestEncryptDecrypt (0.00 seconds)
36- hashids_test.go:21: [45 434 1313 99] -> woQ2vqjnG7nnhzEsDkiYadKa3O71br -> [45 434 1313 99]
37- === RUN TestDefaultLength
38- --- PASS: TestDefaultLength (0.00 seconds)
39- hashids_test.go:47: [45 434 1313 99] -> 7nnhzEsDkiYa -> [45 434 1313 99]
40- === RUN TestCustomAlphabet
41- --- PASS: TestCustomAlphabet (0.00 seconds)
42- hashids_test.go:74: [45 434 1313 99] -> MAkhkloFAxAoskax -> [45 434 1313 99]
34+ === RUN TestEncryptDecrypt
35+ --- PASS: TestEncryptDecrypt (0.00s)
36+ hashids_test.go:22: [45 434 1313 99] -> woQ2vqjnG7nnhzEsDkiYadKa3O71br -> [45 434 1313 99]
37+ === RUN TestEncryptDecryptInt64
38+ --- PASS: TestEncryptDecryptInt64 (0.00s)
39+ hashids_test.go:49: [45 434 1313 99 9223372036854775807] -> ZvGlaahBptQNfPOuPjJ51zO3wVzP01 -> [45 434 1313 99 9223372036854775807]
40+ === RUN TestEncryptWithKnownHash
41+ --- PASS: TestEncryptWithKnownHash (0.00s)
42+ hashids_test.go:75: [45 434 1313 99] -> 7nnhzEsDkiYa
43+ === RUN TestDecryptWithKnownHash
44+ --- PASS: TestDecryptWithKnownHash (0.00s)
45+ hashids_test.go:92: 7nnhzEsDkiYa -> [45 434 1313 99]
46+ === RUN TestDefaultLength
47+ --- PASS: TestDefaultLength (0.00s)
48+ hashids_test.go:115: [45 434 1313 99] -> 7nnhzEsDkiYa -> [45 434 1313 99]
49+ === RUN TestMinLength
50+ --- PASS: TestMinLength (0.00s)
51+ === RUN TestCustomAlphabet
52+ --- PASS: TestCustomAlphabet (0.00s)
53+ hashids_test.go:150: [45 434 1313 99] -> MAkhkloFAxAoskax -> [45 434 1313 99]
54+ === RUN TestDecryptWithError
55+ --- PASS: TestDecryptWithError (0.00s)
4356PASS
4457```
4558
0 commit comments