Is there a way to convert a Go type like []string
to a set<text>
using gocql? Or do I need to make my own mapper for that? I know gocql is able to convert a Go value to a Scylla/Cassandra value with their marshaller but I want to get the type, not the data value (gocql returns a byte array).
Thank you!
I found that gocqltable does the trick for what I want.
gocqltable has a mapper built in to convert Go types to Cassandra types, so I copied the type.go
file into my project (since the original is unexported) and used it as specified in table.go
.
You can find the stringTypeOf
method I used here, and the usage of it here.