1

I'm trying to figure out the best way to use a key-value store from Golang in a Microsoft Azure environment and understand that CosmosDB can provide that, but I'm a little confused on how to best consume that. One thing that I'd really like is the ability to set a TTL on entities I insert into my table.

I see that CosmosDB has the Tables API, however I the only Golang package I see that would let me interface with that is the package intended to be used with Azure Table Storage, and there's no way to programmatically set the TTL in that case, correct?

I believe that both the SQL API and Mongo API can provide me with a document database. Is that correct? Would that be suitable to use as a k/v store with reasonably quick lookup times?

Thanks

  • 1
    See here for GO SDK for Cosmos DB SQL API, https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/data/azcosmos This only supports point operations today so ok for use when using Cosmos SQL API as k/v store, not query support today. Please note this is in preview, not GA. Please provide feedback on issues list on that repo. – Mark Brown Aug 10 '22 at 16:25

1 Answers1

0

Following on Mark's response, please use the Cosmos DB Go SDK: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos

It currently supports:

  • Authentication by master key and RBAC/MSI/AAD
  • Point operations (covers your k-v needs)
  • TransactionalBatch
  • Query on single partition

The Go page contains the examples and usage documentation of the package.

Matias Quaranta
  • 13,907
  • 1
  • 22
  • 47