mirror of
https://github.com/aykhans/go-utils.git
synced 2025-10-15 18:25:57 +00:00
feat: add IsNilOrZero utility function to common package
This commit is contained in:
10
common/compare.go
Normal file
10
common/compare.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package common
|
||||
|
||||
func IsNilOrZero[T comparable](value *T) bool {
|
||||
if value == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
var zero T
|
||||
return *value == zero
|
||||
}
|
Reference in New Issue
Block a user