The dynamic encoder self-organizes around the types that are written to it. No need to define the schema up front! We track the types seen first-come, first-served and the CSUP metadata structure follows accordingly.
(vec vector.Any)
| 29 | // We track the types seen first-come, first-served and the |
| 30 | // CSUP metadata structure follows accordingly. |
| 31 | func (d *DynamicEncoder) Write(vec vector.Any) { |
| 32 | if vec.Len() == 0 { |
| 33 | return |
| 34 | } |
| 35 | if dynamic, ok := vec.(*vector.Dynamic); ok { |
| 36 | d.appendDynamic(dynamic) |
| 37 | } else { |
| 38 | d.appendVec(vec) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func (d *DynamicEncoder) appendDynamic(vec *vector.Dynamic) { |
| 43 | var tagmap []uint32 // input tags to local tags |
nothing calls this directly
no test coverage detected