Tag to restrict property output


Because we use json:"fieldName" tags now for Couchbase, what is the approach to restrict a property when exposing it via JSON, i.e. for the cases when we used json:"-" before?

Thank you,

Just as a thought, maybe its better to use a custom tag (“cb”)? Like “cql” in Cassandra and “db” for MySQL and “aql” for Aerospike and “bson” for Mongo?

Hey @dennis,
This seems like a useful feature to have as part of the SDK so that you can easily separate data that is shared to the web and data that is shared to Couchbase from structures. This would however cause a backwards-compatibility break which I do not think we could include anytime soon.
Cheers, Brett

Hi @brett19
Agree, it will break backwards-compatibility :confused: however this behavior is a Go’s native feature. I’m migrating from a different DB and had to write a workaround to avoid exporting some fields. Not a problem, some short code, but it’ll have to be applied on every call to a related API endpoint. I’m sure you get the picture.
I think we can close this thread now as you are right, maybe other users will have issues because of broken compatibility, but current approach just does not sound right + we expect new users joining the Go/Couchbase world and they’ll have similar questions, right? ))