(cctx *Context, typ *super.TypeUnion)
| 18 | var _ Encoder = (*UnionEncoder)(nil) |
| 19 | |
| 20 | func NewUnionEncoder(cctx *Context, typ *super.TypeUnion) *UnionEncoder { |
| 21 | var values []Encoder |
| 22 | for _, typ := range typ.Types { |
| 23 | values = append(values, NewEncoder(cctx, typ)) |
| 24 | } |
| 25 | return &UnionEncoder{ |
| 26 | typ: typ, |
| 27 | values: values, |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func (u *UnionEncoder) Write(vec vector.Any) { |
| 32 | if vec.Len() == 0 { |
no test coverage detected