Last active
June 22, 2023 09:11
-
-
Save tbmreza/e293e1a7edb98d7442276441d1f45d45 to your computer and use it in GitHub Desktop.
a growing snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Deref(s *string) string { | |
if s != nil { | |
return *s | |
} | |
return "" | |
} | |
func ParseInt64OrDefault(s string) int64 { | |
n, strconvErr := strconv.ParseInt(s, 10, 64) | |
if strconvErr != nil { | |
return 0 | |
} | |
return n | |
} | |
func JsonPrint(input interface{}) { | |
str, _ := json.Marshal(input) | |
log.Println("str:\n", string(str)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment