I think we have a similar setup to what you are trying to do, we also 
started with Scala and about 3 years ago we moved it to Go (still use Scala 
for other parts of our app).

While working in Scala and other languages you are encourage to abstract 
things as much as you can, in Go it is often better to just address the 
issues/requirements at hand and be clear on what you are doing.
In our case we define a struct that has the expected fields and types for 
each column, and as we walk each row, we check that we get the expected 
type, then it's a matter of cleaning/adjusting values as we need to, assign 
the result of this cell to a variable and continue with the rest of the 
cells on this row, once done, we initialize our struct and save it to the 
database, move to the next row and repeat.

Hope it helps.


On Wednesday, July 26, 2017 at 10:09:07 AM UTC-4, Sofiane Cherchalli wrote:
>
> The schema is statically specified. The values always arrive in a defined 
> order. Each value has a defined type.
>
> On Tuesday, July 25, 2017 at 3:01:14 AM UTC+2, rog wrote:
>>
>> On 24 July 2017 at 23:21, Sofiane Cherchalli <sofi...@gmail.com> wrote:
>>
>>> Yes, I'm trying to stream CSV values encoded in strings. A schema 
>>> defines a type of each value, so I have to parse values to verify they 
>>> match the type. Once validation is done, I apply functions on each value.
>>>
>>
>> Is the schema dynamically or statically specified? That is, do you know
>> in advance what the schema is, or do are you required to write
>> general code that deals with many possible schemas?
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to