Json Atomic increment


#1

Is there a golang API similar to counter available in other couchbase SDK’s that will help us to atomically increment certain fields inside a json document?

For example, I have a below struct with two fields which will be associated with a document D1

type Counter struct {
c1 string json:"c1"
c2 string json:"c2"
}

For every http request that comes in , I would like todo an atomic increment of c1 and c2. since it’s within a json document, am not able to use GET and not sure how to use counter method. Any help is greatly appreciated.

-Ram


#2

Hey rrengamani,

Which Go SDK are you using?

Cheers, Brett


#3

Hello Brett,

I am not sure how to find the SDK version but in my code i use this statement in the import

Is there a place where i can check the SDK version?

-Ram


#4

By the way, the couchbase am using is CB 3.0.1


#5

go version we use is 1.2.1