page_type languages products description urlFragment
sample
go
azure
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:

Running this sample

  1. Clone this repository using git clone https://github.com/griffinbird/go-cassandra-change-feed

  2. Change directories to the repo using cd go-cassandra-change-feed

  3. 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>
  1. Run the application

go mod tidy
go run main.go

More information

GitHub

View Github