Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Golang client for Cassandra [closed]

Tags:

go

cassandra

I am looking for a golang client for Cassandra with unit testing support. I have found some libraries like

  1. Goosie (not maintained any more)
  2. gocql (any client library with no testing support is useless for me)
  3. gocassa (same issue as above)

Can someone suggest me any client lib that has what I am looking for ?

like image 443
pbathala Avatar asked Dec 11 '15 17:12

pbathala


Video Answer


1 Answers

This is a very simple example of what I was referring to in the comments:

type CassAPI interface {
    GetFoo(rowKey string) (someType, error)
}

type CassWrapper struct {
    cass *gocql.Session
}

func (cw *CassWrapper) GetFoo(rowKey string) (someType, error) {
    // do things with cw.cass
    return someType
}

In the application code, an instance of CassWrapper would be used, and in tests an instance of some mock or stub would be used which adhered to the same interface of CassAPI.

like image 100
sberry Avatar answered Sep 24 '22 19:09

sberry