Files
next.orly.dev/pkg/utils/pointers/pointers.go
mleku 110223fc4e Migrate internal module imports to unified package path.
Replaced legacy `*.orly` module imports with `next.orly.dev/pkg` paths across the codebase for consistency. Removed legacy `go.mod` files from sub-packages, consolidating dependency management. Added Dockerfiles and configurations for benchmarking environments.
2025-09-12 16:12:31 +01:00

24 lines
729 B
Go

package pointers
import (
"time"
"next.orly.dev/pkg/encoders/timestamp"
)
// PointerToValue is a generic interface (type constraint) to refer to any
// pointer to almost any kind of common type of value.
//
// see the utils/values package for a set of methods to accept these values and
// return the correct type pointer to them.
type PointerToValue interface {
~*uint | ~*int | ~*uint8 | ~*uint16 | ~*uint32 | ~*uint64 | ~*int8 | ~*int16 | ~*int32 |
~*int64 | ~*float32 | ~*float64 | ~*string | ~*[]string | ~*time.Time | ~*time.Duration |
~*[]byte | ~*[][]byte | ~*timestamp.T
}
// Present determines whether there is a value for a PointerToValue type.
func Present[V PointerToValue](i V) bool {
return i != nil
}