page_type | languages | products | description | urlFragment | ||
---|---|---|---|---|---|---|
sample
|
|
|
Azure Cosmos DB is a globally distributed multi-model database. One of the supported APIs is the Cassandra API
|
azure-cosmos-db-cassandra-go-changefeed
|
Developing a Go app with Cassandra API using Azure Cosmos DB (gocql
Driver) using Cosmos DB Change Feed
Azure Cosmos DB is a globally distributed multi-model database. One of the supported APIs is the Cassandra API.
The code included in this sample is intended to get you quickly started with a Go application that connects to Azure Cosmos DB with the Cassandra API. It walks you through creation of keyspace, table, inserting and querying the data using the Cosmos DB Change Feed.
Prerequisites
Before you can run this sample, you must have the following prerequisites:
- An Azure account with an active subscription. Create one for free. Or try Azure Cosmos DB for free without an Azure subscription.
- Go installed on your computer, and a working knowledge of Go.
- Git.
Running this sample
-
Clone this repository using
git clone https://github.com/griffinbird/go-cassandra-change-feed
-
Change directories to the repo using
cd go-cassandra-change-feed
-
Set environment variables. Either in the shell or via .env
export COSMOSDB_CASSANDRA_CONTACT_POINT=<Contact Point for Azure Cosmos DB Cassandra API>
export COSMOSDB_CASSANDRA_PORT=<Port for Azure Cosmos DB Cassandra API>
export COSMOSDB_CASSANDRA_USER=<Username for Azure Cosmos DB Cassandra API>
export COSMOSDB_CASSANDRA_PASSWORD=<Password for Azure Cosmos DB Cassandra API>
- Run the application
go mod tidy
go run main.go