https://github.com/gonejack/gf
Golang fallback
https://github.com/gonejack/gf
Last synced: about 1 month ago
JSON representation
Golang fallback
- Host: GitHub
- URL: https://github.com/gonejack/gf
- Owner: gonejack
- License: mit
- Created: 2020-07-13T03:06:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-13T03:21:48.000Z (over 5 years ago)
- Last Synced: 2024-06-20T15:57:35.451Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gf
golang fallback
```golang
func EmptyFallback(s, def string) string {
if s == "" {
return def
}
return s
}
func ZeroFallback(i, def int) int {
if i == 0 {
return def
}
return i
}
func Max(i, max int) int {
if i > max {
return max
}
return i
}
func Min(i, min int) int {
if i < min {
return min
}
return i
}
```