nip/internal/pkg/encoding/encode.go

19 lines
249 B
Go

package encoding
import (
"encoding/json"
"io"
)
type encoder struct {
w io.Writer
}
func NewEncoder(w io.Writer) Encoder {
return &encoder{w}
}
func (e *encoder) Encode(v interface{}) (err error) {
return json.NewEncoder(e.w).Encode(&v)
}