mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-16 18:23:08 +03:00
14 lines
156 B
Go
14 lines
156 B
Go
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
|
|
}
|