add trait for row to string converting without file#37
add trait for row to string converting without file#37turkishjoe wants to merge 1 commit intokeboola:masterfrom
Conversation
|
First, thank you for the contribution. I don't think trait is a good fit for this, though. I think this could be a normal class (CsvFormatter) with pure function (having all the row, delimiter, enclosure, etc. as parameters) that can have proper test. That class can then be used by the means of composition in the CSV file class... |
|
Trait is not best solution for it. But i put for legacy. Method rowToStr should be removed from CsvWriter. It was my case. I needed only csv row, but not in file. My fast solution was. I want make a normal solution. I will try do it.
|
|
You are right that we'd need to reimplement all the input parameters validation in such class. This will probably need some further refactoring. Maybe adding a ValueObject holding validated settings that could be passed along - something like CsvFormatParameters. That way the formatter would only need this object and the same object could be used in CsvFile and whereever else we wanted. Let me think about that... |
|
Yeah! It is good idea. Also we can use something like Input/Output interface and read/write csv rows from stdin/out or file. I also think about it. |
I need convert my row to csv format without creating file. Your function rowToStr was usefull for me.