NewDialEncoder returns a new instance of DialEncoder that writes to w.
(w io.Writer)
| 16 | |
| 17 | // NewDialEncoder returns a new instance of DialEncoder that writes to w. |
| 18 | func NewDialEncoder(w io.Writer) *DialEncoder { |
| 19 | enc := &DialEncoder{w: csv.NewWriter(w)} |
| 20 | |
| 21 | // Write header to underlying writer. |
| 22 | _ = enc.w.Write([]string{ |
| 23 | "id", |
| 24 | "name", |
| 25 | "value", |
| 26 | "created_by", |
| 27 | "created_at", |
| 28 | "updated_at", |
| 29 | }) |
| 30 | |
| 31 | return enc |
| 32 | } |
| 33 | |
| 34 | // Close flushes the underlying writer. |
| 35 | func (enc *DialEncoder) Close() error { |