We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
table/types.IsOptional()
1 parent c636165 commit 78465f7Copy full SHA for 78465f7
CHANGELOG.md
@@ -1,3 +1,5 @@
1
+* Added `table/types.IsOptional()` helper
2
+
3
## v3.48.2
4
* Refactored tests
5
table/types/cast.go
@@ -18,6 +18,16 @@ func CastTo(v Value, dst interface{}) error {
18
return value.CastTo(v, dst)
19
}
20
21
+func IsOptional(t Type) (isOptional bool, innerType Type) {
22
+ if optionalType, isOptional := t.(interface {
23
+ IsOptional()
24
+ InnerType() Type
25
+ }); isOptional {
26
+ return isOptional, optionalType.InnerType()
27
+ }
28
+ return false, nil
29
+}
30
31
// ToDecimal returns Decimal struct from abstract Value
32
func ToDecimal(v Value) (*Decimal, error) {
33
if valuer, isDecimalValuer := v.(value.DecimalValuer); isDecimalValuer {
0 commit comments