Questions tagged [gocql]

GOCQL is the golang driver for connecting to Cassandra.

GOCQL is the Google go language's driver for connecting to Apache Cassandra.

91 questions
0
votes
0 answers

gocql bind not working in the case of concurrent calls

I have been trying to reuse a the prepared query in concurrent calls. type product struct { query *gocql.Query } type resp struct { Pk string Product Product Err error } func (p *product) A() { ... respFromDB := make(chan…
0
votes
0 answers

Cassandra inconsistent/partial records inserted

I have a table where I have 4 columns A,B,C,D namely. I am using LWT for all create/update/delete operations in this table. A is my only primary key. My queries are somewhat like this:- INSERT INTO xTable(A,B,D) Values ('123','','456') IF NOT…
0
votes
1 answer

Initialize gocql ips using a constant

I need to initialize gocql with multiple ips, I want to pass the ips from a variable/constant. How to pass some thing like gocql.NewCluster(ipvalues) instead of using gocql.NewCluster("127.0.0.1", "127.0.0.2") i want to pass the list of ips…
Gokul Raj Kumar
  • 335
  • 2
  • 9
0
votes
1 answer

MapScan can not unmarshal to non-pointer int64

I used MapScan and iterate on it with this error can not unmarshal into non-pointer int64 Errors out after the first iteration. This is the code I was working on: type NotFinishedTBLFields struct { Bulk_id int64 Recipient …
elham anari
  • 518
  • 2
  • 8
  • 22
0
votes
1 answer

Create type inside if condition

Requirement: type A struct {//some code} type B struct {//some code} func getData(db string) interface{} { if db == "dbA" { // problem with this if condition type C A } else { type C B } var byteData []byte …
Nannan AV
  • 419
  • 7
  • 22
0
votes
0 answers

CQLC: Go Cassandra query returning page token for boundary limit?

In my Cassandra database for a particular query, I have 8 records, and I am using GoLang relops/cqlc library. When I query with limit = 8, it returns 8 records with a PageState which is to be used as page token for the next set of results. I don't…
Tanny
  • 540
  • 4
  • 29
0
votes
1 answer

On using DCAwareRoundRobinPolicy, read also searching on remote hosts

I am using DCAwareRoundRobinPolicy for my cassandra connection. But the time taken for querying by my driver is comparatively larger than when i am using the same connection parameters in php. The datastax driver in php uses the function to the the…
Nupur Bansal
  • 21
  • 1
  • 3
0
votes
1 answer

Storing slice of bytes in Cassandra using gocql driver

How to store slice of bytes as cassandra blob type using gocql driver?
0
votes
0 answers

'go test' returns error "gocql: no response received from cassandra within timeout period."

So i want to test out an API that interacts with Cassandra on my local machine. In my func TestMain(m *testing.M) function, i want to clear the tables before running the tests. The TestMain function looks like this... func TestMain(m *testing.M) { …
SomeGuyFortune
  • 1,024
  • 13
  • 26
0
votes
1 answer

Variadic arguments in cassandra query with gocql

I want to make a generic function for performing cassandra queries using the gocql client, something like : queryExec("INSERT INTO USERS VALUES(?,?,?,?)", userId, emailId, mobileNo, gender) func queryExec(query string, args ...interface{})…
chetan dev
  • 611
  • 2
  • 6
  • 16
0
votes
1 answer

UDT are not available on protocols less than 3, please update config"

Using UDT: Note: cqlsh: show version [cqlsh 5.0.1 | Cassandra 2.2.1 | CQL spec 3.3.0 | Native protocol v4] Tables CREATE TYPE fullname ( firstname text, lastname text ); CREATE TABLE sample ( id int PRIMARY KEY, name frozen…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
0
votes
1 answer

SliceMap when using PageSize

I am trying to implement paging but when I use SliceMap with PageSize I get all the rows - do you know why and what to do? Note: I need the row maps keyed by CQL column mames. iter := session.Query("SELECT * FROM…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
0
votes
1 answer

How do you execute a cql file using gocql?

If you were to interface directly with Cassandra using cqlsh you could do the following: $ cqlsh cqlsh:test> SOURCE '/home/me/reset_db.cql' I've tried to do this using gocql several times but I always get an error. For example, running…
0
votes
1 answer

Transaction in cassandra and I am using gocql

How can you make sure that one user insert is not influenced by another user? Like transactions... Do you use a batch job in combination with IF NOT EXISTS? BEGIN UNLOGGED BATCH INSERT INTO atable ("user1") value (10) INSERT INTO atable ("user2")…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
-2
votes
1 answer

Writing timestamps to database - gocql vs cqlsh

Desired format to write time stamp, in cassandra database: 2021-01-17 21:51:46.195 Using cqlsh syntax for insert query: am able to write the above format using toTimeStamp(toDate(now())) Using cqlsh, am unable to write the above format using…
overexchange
  • 15,768
  • 30
  • 152
  • 347