MCPcopy Create free account
hub / github.com/brimdata/super / Nullable

Method Nullable

context.go:634–647  ·  view source on GitHub ↗
(typ Type)

Source from the content-addressed store, hash-verified

632}
633
634func (c *Context) Nullable(typ Type) *TypeUnion {
635 var types []Type
636 if union, ok := TypeUnder(typ).(*TypeUnion); ok {
637 for _, t := range union.Types {
638 if t == TypeNull {
639 return union
640 }
641 }
642 types = slices.Clone(union.Types)
643 } else {
644 types = []Type{typ}
645 }
646 return c.LookupTypeUnion(append(types, TypeNull))
647}
648
649func NullableUnion(typ Type) (*TypeUnion, int) {
650 if union, ok := typ.(*TypeUnion); ok {

Callers 2

ToFunction · 0.80
CastMethod · 0.80

Calls 3

LookupTypeUnionMethod · 0.95
TypeUnderFunction · 0.85
CloneMethod · 0.65

Tested by

no test coverage detected