mirror of
https://github.com/xinliangnote/go-gin-api.git
synced 2024-04-21 12:31:46 +00:00
19 lines
330 B
Go
19 lines
330 B
Go
package hash
|
|
|
|
import "testing"
|
|
|
|
const secret = "i1ydX9RtHyuJTrw7frcu"
|
|
const length = 12
|
|
|
|
func TestHashidsEncode(t *testing.T) {
|
|
str, _ := New(secret, length).HashidsEncode([]int{99})
|
|
t.Log(str)
|
|
|
|
//GyV5pJqXvwAR
|
|
}
|
|
|
|
func TestHashidsDecode(t *testing.T) {
|
|
ids, _ := New(secret, length).HashidsDecode("GyV5pJqXvwAR")
|
|
t.Log(ids)
|
|
}
|