These are chat archives for nrinaudo/kantan.csv

5th
Feb 2018
Julien Truffaut
@julien-truffaut
Feb 05 2018 10:59
Hey
Nicolas Rinaudo
@nrinaudo
Feb 05 2018 11:00
Hello there
Julien Truffaut
@julien-truffaut
Feb 05 2018 11:00
I couldn't find if there exist a CsvWriter for String
I would like to use it in a test
Nicolas Rinaudo
@nrinaudo
Feb 05 2018 11:00
to take a List[A: RowEncoder] and write it to a String, you mean?
Julien Truffaut
@julien-truffaut
Feb 05 2018 11:01
yes
Nicolas Rinaudo
@nrinaudo
Feb 05 2018 11:02
in one go, or row by row?
Julien Truffaut
@julien-truffaut
Feb 05 2018 11:02
doesn't really matter
Nicolas Rinaudo
@nrinaudo
Feb 05 2018 11:02
if it's for tests and you're ok with some degree of mutability, something like this should work:
import java.io._
import kantan.csv._
import kantan.csv.ops._

val out = new StringWriter()
out.writeCsv(data, rfc)
out.toString
(maybe with a few tweaks, this is off the cuff and there might be some details I got wrong from memory)
Julien Truffaut
@julien-truffaut
Feb 05 2018 11:06
thanks, it seems to work!
Nicolas Rinaudo
@nrinaudo
Feb 05 2018 11:07
:thumbsup:
off topic, but I know your name from somewhere. What library of yours might I be using?
Julien Truffaut
@julien-truffaut
Feb 05 2018 11:08
probably monocle
Nicolas Rinaudo
@nrinaudo
Feb 05 2018 11:08
yeah, that's the one
good job on that one :)
Julien Truffaut
@julien-truffaut
Feb 05 2018 11:08
thanks, and to you too for kantan :)
Nicolas Rinaudo
@nrinaudo
Feb 05 2018 11:09
aside from the name, obviously - I thought I was being clever naming all my libraries kantan.something, but everybody calles kantan.csv just kantan
Julien Truffaut
@julien-truffaut
Feb 05 2018 11:15
ah I didn't know they were others
Nicolas Rinaudo
@nrinaudo
Feb 05 2018 11:15
only two of note, one for decoding regular expression matches and one for XPath queries
I had a mongodb one in the works but since we've stopped using it at work, I don't think I'll be able to motivate myself to finish it
and there's a generic codec one, which is basically what every other one uses under the hood and abstracts over the notion of what a decoder / encoder are