Improve syncer code.

This commit is contained in:
Yang Luo
2021-12-19 22:30:54 +08:00
parent e7f395cfd4
commit 5ee5299a68
8 changed files with 230 additions and 83 deletions

View File

@ -27,6 +27,10 @@ import (
)
func ParseInt(s string) int {
if s == "" {
return 0
}
i, err := strconv.Atoi(s)
if err != nil {
panic(err)
@ -35,6 +39,19 @@ func ParseInt(s string) int {
return i
}
func ParseBool(s string) bool {
i := ParseInt(s)
return i != 0
}
func BoolToString(b bool) string {
if b {
return "1"
} else {
return "0"
}
}
func GetOwnerAndNameFromId(id string) (string, string) {
tokens := strings.Split(id, "/")
if len(tokens) != 2 {