chore: update id type to int32

This commit is contained in:
Steven
2023-08-02 08:41:56 +08:00
parent c26834e9cd
commit d6dccb1f95
14 changed files with 61 additions and 50 deletions

View File

@ -1,6 +1,18 @@
package util
import "strings"
import (
"strconv"
"strings"
)
// ConvertStringToInt32 converts a string to int32.
func ConvertStringToInt32(src string) (int32, error) {
i, err := strconv.Atoi(src)
if err != nil {
return 0, err
}
return int32(i), nil
}
// HasPrefixes returns true if the string s has any of the given prefixes.
func HasPrefixes(src string, prefixes ...string) bool {