nip/internal/pkg/encoding/decoder.go

19 lines
249 B
Go
Raw Normal View History

2024-08-25 18:57:31 +08:00
package encoding
import (
"encoding/json"
"io"
)
type decoder struct {
r io.Reader
}
func NewDecoder(r io.Reader) Decoder {
return &decoder{r}
}
func (d *decoder) Decode(v interface{}) (err error) {
return json.NewDecoder(d.r).Decode(&v)
}