13 lines
323 B
Go
13 lines
323 B
Go
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()
|
|
}
|