gocql MapScanCAS Usage

157 views
Skip to first unread message

Dave Rose

unread,
Jun 15, 2015, 1:23:11 PM6/15/15
to golan...@googlegroups.com
Hi,

I am hoping i can get an assist here. I am trying to use the gocql driver with INSERT IF ... EXISTS but my geocode is not quite right. 




The error is:

# command-line-arguments

./networkdataloadhack.go:108: not enough arguments in call to session.Query("INSERT INTO networks (provider_name,target_platform,source_field,source_value,\n            target_value,active,sequence,created_by_user)\n                VALUES (?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS", j.Value.(*Network).providerName, j.Value.(*Network).targetPlatform, j.Value.(*Network).sourceField, j.Value.(*Network).sourceValue, j.Value.(*Network).targetValue, j.Value.(*Network).active, j.Value.(*Network).sequence, j.Value.(*Network).createdByUser).MapScanCAS



Kiki Sugiaman

unread,
Jun 15, 2015, 2:11:07 PM6/15/15
to golan...@googlegroups.com
I've never used gocql so I'm making a few assumptions.
If MapScanCAS is the one with this signature: https://godoc.org/github.com/gocql/gocql#Query.MapScanCAS
then it takes 1 arg. In your code, you are calling it without any.
--
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben Hood

unread,
Jun 15, 2015, 8:13:41 PM6/15/15
to Kiki Sugiaman, golang-nuts
Hi Dave,

It's slightly difficult to read the snippet you posted but on face
value it looks like you might have missed out the destination for the
result data.

Here is an example for MapScanCAS from the test suite:

https://github.com/gocql/gocql/blob/ec1f5626d6984ebe4da69779317a76f3a6698381/cassandra_test.go#L363

BTW, it might be better to ask this question on the gocql mailing list.

Cheers,

Ben

Dave Rose

unread,
Jun 16, 2015, 8:52:23 AM6/16/15
to golan...@googlegroups.com, ksug...@gmail.com
Thanks Ben. I'll use the gocql list. I appreciate your help. 
Reply all
Reply to author
Forward
0 new messages