NewSegmentDecoder returns a Decoder given the passed string.
(dataEncoding string)
| 33 | |
| 34 | // NewSegmentDecoder returns a Decoder given the passed string. |
| 35 | func NewSegmentDecoder(dataEncoding string) (SegmentDecoder, error) { |
| 36 | switch dataEncoding { |
| 37 | case v1.Encoding: |
| 38 | return v1.NewSegmentDecoder(), nil |
| 39 | case v2.Encoding: |
| 40 | return v2.NewSegmentDecoder(), nil |
| 41 | } |
| 42 | |
| 43 | return nil, fmt.Errorf("unknown encoding %s. Supported encodings %v", dataEncoding, AllEncodings) |
| 44 | } |
| 45 | |
| 46 | // MustNewSegmentDecoder creates a new encoding or it panics |
| 47 | func MustNewSegmentDecoder(dataEncoding string) SegmentDecoder { |