Files
pocket-id/backend/internal/utils/ptr_util.go

14 lines
156 B
Go
Raw Normal View History

package utils
func Ptr[T any](v T) *T {
return &v
}
func PtrValueOrZero[T any](ptr *T) T {
if ptr == nil {
var zero T
return zero
}
return *ptr
}