mirror of
https://github.com/cloudnativelabs/kube-router.git
synced 2026-05-04 14:21:39 +02:00
25 lines
370 B
Go
25 lines
370 B
Go
package testutils
|
|
|
|
import (
|
|
"net"
|
|
|
|
v1core "k8s.io/api/core/v1"
|
|
|
|
"github.com/cloudnativelabs/kube-router/v2/pkg/utils"
|
|
)
|
|
|
|
type TestValue interface {
|
|
string | int32 | bool | uint32 | net.IP | v1core.Protocol | utils.Base64String
|
|
}
|
|
|
|
func ValToPtr[V TestValue](v V) *V {
|
|
return &v
|
|
}
|
|
|
|
func PtrToVal[V TestValue](v *V) V {
|
|
if v == nil {
|
|
return *new(V)
|
|
}
|
|
return *v
|
|
}
|