gf

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2020 License: MIT Imports: 0 Imported by: 0

README

gf

golang fallback

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
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyFallback

func EmptyFallback(s, def string) string

func Max

func Max(i, max int) int

func Min

func Min(i, min int) int

func ZeroFallback

func ZeroFallback(i, def int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL