diff --git a/driver/cassandra/cassandra.go b/driver/cassandra/cassandra.go index faea2a2..e242de2 100644 --- a/driver/cassandra/cassandra.go +++ b/driver/cassandra/cassandra.go @@ -4,6 +4,7 @@ package cassandra import ( "fmt" "net/url" + "strconv" "strings" "time" @@ -40,10 +41,10 @@ const ( ) // Cassandra Driver URL format: -// cassandra://host:port/keyspace +// cassandra://host:port/keyspace?protocol=version // // Example: -// cassandra://localhost/SpaceOfKeys +// cassandra://localhost/SpaceOfKeys?protocol=4 func (driver *Driver) Initialize(rawurl string) error { u, err := url.Parse(rawurl) @@ -52,6 +53,15 @@ func (driver *Driver) Initialize(rawurl string) error { cluster.Consistency = gocql.All cluster.Timeout = 1 * time.Minute + if len(u.Query().Get("protocol")) > 0 { + protoversion, err := strconv.Atoi(u.Query().Get("protocol")) + if err != nil { + return err + } + + cluster.ProtoVersion = protoversion + } + // Check if url user struct is null if u.User != nil { password, passwordSet := u.User.Password()