gitea源码

12345678910111213141516171819202122
  1. // Copyright 2023 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package internal
  4. import (
  5. "fmt"
  6. "strconv"
  7. )
  8. func Base36(i int64) string {
  9. return strconv.FormatInt(i, 36)
  10. }
  11. func ParseBase36(s string) (int64, error) {
  12. i, err := strconv.ParseInt(s, 36, 64)
  13. if err != nil {
  14. return 0, fmt.Errorf("invalid base36 integer %q: %w", s, err)
  15. }
  16. return i, nil
  17. }