diff --git a/utils/bool.go b/utils/bool.go index f0e366e7f07c..ab2eec6efbdb 100644 --- a/utils/bool.go +++ b/utils/bool.go @@ -5,6 +5,7 @@ package utils // NormaliseNilableBool takes a pointer to a bool and returns a zero value or // the real value if present +// Deprecated: please use the `From` function in the `pointer` package func NormaliseNilableBool(input *bool) bool { if input == nil { return false diff --git a/utils/float.go b/utils/float.go index 60c8332148c0..e37ff7015e2b 100644 --- a/utils/float.go +++ b/utils/float.go @@ -4,6 +4,7 @@ package utils // NormalizeNilableFloat normalizes a nilable float64 into a float64 value +// Deprecated: please use the `From` function in the `pointer` package func NormalizeNilableFloat(input *float64) float64 { if input == nil { return 0 @@ -13,6 +14,7 @@ func NormalizeNilableFloat(input *float64) float64 { } // NormalizeNilableFloat32 normalizes a nilable float32 into a float32 value +// Deprecated: please use the `From` function in the `pointer` package func NormalizeNilableFloat32(input *float32) float32 { if input == nil { return 0 diff --git a/utils/int.go b/utils/int.go index e4cfb9d55919..6e656f1002ec 100644 --- a/utils/int.go +++ b/utils/int.go @@ -5,6 +5,7 @@ package utils // NormaliseNilableInt takes a pointer to an int and returns a zero value or // the real value if present +// Deprecated: please use the `From` function in the `pointer` package func NormaliseNilableInt(input *int) int { if input == nil { return 0 @@ -15,6 +16,7 @@ func NormaliseNilableInt(input *int) int { // NormaliseNilableInt32 takes a pointer to an int32 and returns a zero value or // the real value if present +// Deprecated: please use the `From` function in the `pointer` package func NormaliseNilableInt32(input *int32) int32 { if input == nil { return 0 @@ -25,6 +27,7 @@ func NormaliseNilableInt32(input *int32) int32 { // NormaliseNilableInt64 takes a pointer to an int64 and returns a zero value or // the real value if present +// Deprecated: please use the `From` function in the `pointer` package func NormaliseNilableInt64(input *int64) int64 { if input == nil { return 0 diff --git a/utils/pointer.go b/utils/pointer.go index 7c4cc8fdf880..2097732dee5c 100644 --- a/utils/pointer.go +++ b/utils/pointer.go @@ -3,26 +3,38 @@ package utils +// Bool +// Deprecated: please use the `To` function in the `pointer` package func Bool(input bool) *bool { return &input } +// Int32 +// Deprecated: please use the `To` function in the `pointer` package func Int32(input int32) *int32 { return &input } +// Int64 +// Deprecated: please use the `To` function in the `pointer` package func Int64(input int64) *int64 { return &input } +// Float +// Deprecated: please use the `To` function in the `pointer` package func Float(input float64) *float64 { return &input } +// String +// Deprecated: please use the`To` function in the `pointer` package func String(input string) *string { return &input } +// StringSlice +// Deprecated: please use the `To` function in the `pointer` package func StringSlice(input []string) *[]string { if input == nil { return nil diff --git a/utils/string.go b/utils/string.go index ae2cb8b97b8e..2e40b0fa07b5 100644 --- a/utils/string.go +++ b/utils/string.go @@ -5,6 +5,7 @@ package utils // NormalizeNilableString normalizes a nilable string into a string // that is, if it's nil returns an empty string else the value +// Deprecated: please use the `From` function in the `pointer` package func NormalizeNilableString(input *string) string { if input == nil { return ""