This module is to generate serial uuid code with short length.
There are two feature:
-
- Default UUID [0-9a-z] (total 36). Eg: "zzzzz" = 36 * 36 * 36 * 36 * 36 = 60,466,176 - 1
-
- Custom UUID
-
- Convert to Code from decimal
go get github.com/lwinmgmg/uuid_code
import (
uuid_code "github.com/lwinmgmg/uuid_code/v1"
)
uuidCode := uuid_code.NewDefaultUuidCode()
nextCode, _ := uuidCode.GetNext("023abcdz")
print(nextCode)
// will result : "023abce0"
import (
uuid_code "github.com/lwinmgmg/uuid_code/v1"
)
// make binary serial
digitList := []byte{
'0', '1',
}
uuidCode, err := uuid_code.NewUuidCode(digitList)
if err != nil{
// do something
}
nextCode, _ := uuidCode.GetNext("1001010")
print(nextCode)
// will result : "1001011"
import (
uuid_code "github.com/lwinmgmg/uuid_code/v1"
)
uuidCode := uuid_code.NewDefaultUuidCode()
res := uuidCode.ConvertCode(10, 5)
print(res)
// will result : "0000a"