forked from tangled.org/core
Monorepo for Tangled — https://tangled.org
at master 352 B view raw
1// mostly copied from gitea/modules/indexer/internal/base32 2 3package base36 4 5import ( 6 "fmt" 7 "strconv" 8) 9 10func Encode(i int64) string { 11 return strconv.FormatInt(i, 36) 12} 13 14func Decode(s string) (int64, error) { 15 i, err := strconv.ParseInt(s, 36, 64) 16 if err != nil { 17 return 0, fmt.Errorf("invalid base36 integer %q: %w", s, err) 18 } 19 return i, nil 20}