1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-29 13:49:28 +08:00

13 lines
323 B
Go
Raw Normal View History

package cassandra
import "github.com/gocql/gocql"
// Connect establishes connection to the Cassandra cluster.
func Connect(hosts []string, keyspace string) (*gocql.Session, error) {
cluster := gocql.NewCluster(hosts...)
cluster.Keyspace = keyspace
cluster.Consistency = gocql.Quorum
return cluster.CreateSession()
}