gitlab.com/evatix-go/core@v1.3.55/conditional/NilDefInt.go (about) 1 package conditional 2 3 import "gitlab.com/evatix-go/core/constants" 4 5 func NilDefInt( 6 valuePointer *int, 7 ) int { 8 if valuePointer == nil { 9 return constants.Zero 10 } 11 12 return *valuePointer 13 } 14 15 func NilDefIntPtr( 16 valuePointer *int, 17 ) *int { 18 if valuePointer == nil { 19 return constants.ZeroPtr 20 } 21 22 return valuePointer 23 } 24 25 func NilDefValInt( 26 valuePointer *int, 27 defVal int, 28 ) int { 29 if valuePointer == nil { 30 return defVal 31 } 32 33 return *valuePointer 34 }