A wrapper for gocql to use DataStax Astra
DataStax Astra is an offering of DataStax Enterprise Cassandra as a Service on major cloud providers. They offer various tiers of operation including a free tier that is free forever. Part of the delivery of that offering includes MTLS certificate authentication for the drivers. While DataStax itself supports many drivers, the gocql driver is not one of them, so there is no specific inherent support for the secure connect bundle and MTLS authentication. This wrapper provides a path to unpack the Secure Connect Bundle (SCB) and pass it to gocql to get a session to work with.
- DataStax Astra cluster. Any tier will work.
- Download the SCB and unpack it
- Know your database username and password
- hostname from cqlshrc in SCB
- port from cqlshr in SCB
- filepath where the
ca.crt
,key
, andcert
files from the SCB are stored. This is absolute file path with respect to your application's runtime - database username is the username you used when you created the Astra database
- database password is the password you used when you created the Astra database
config := NewClusterConfig(host, port, username, password, filepath)
clusterConnection, _ := NewClusterConnection(config)
clusterConnection.Session()...