I have a UDT in Cassandra and I have a table that has an array of these UDTs in its schema. Here's a sample:
CREATE TYPE keyspace.test_type(
x float,
y float)
In my schema I have
CREATE TABLE test_table(
key text,
test_array list<FROZEN <test_type>>,
PRIMARY KEY (key))
Inside my go package I built a struct:
type Test_type struct{
x float32
y float32
}
Then I have a function that essentially returns a list of this test_type: []test_type
, let's call it my_array
.
When I try to do the insert using gocql like such:
err := gocql.Session.Query('INSERT into test_table (key,test_array)
VALUES (?,?)', 'key', my_array).Exec()
I get a bunch of null values instead of my array. Essentially the test_type does not correctly map to the UDT that I created is my assumption.
Essentially my question is how do you map a struct in go to a udt such that the type is recognized properly. .