summaryrefslogtreecommitdiffstats
path: root/common/types/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'common/types/types.go')
-rw-r--r--common/types/types.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/types/types.go b/common/types/types.go
index 801c511a0..e3850ddac 100644
--- a/common/types/types.go
+++ b/common/types/types.go
@@ -99,6 +99,14 @@ type Unwrapper interface {
Unwrapv() any
}
+// Unwrap returns the underlying value of v if it implements Unwrapper, otherwise v is returned.
+func Unwrapv(v any) any {
+ if u, ok := v.(Unwrapper); ok {
+ return u.Unwrapv()
+ }
+ return v
+}
+
// LowHigh is typically used to represent a slice boundary.
type LowHigh struct {
Low int