You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when JSON is used as MarshalFormat, it will always be converted to []byte. This makes the result unreadable as a human, unless interpreted as / converted back to string. So for example when using DynamoDB, and a struct is marshalled into a JSON {"Foo":"bar"}, saved to DynamoDB with gokv, and then you look at the value via the AWS console, it's just eyJGb28iOiJiYXIifQ==, the Base64 encoding of the JSON string.
That's because in the dynamodb implementation we use a awsdynamodb.AttributeValue for the value where we assign the value to a field B, which is for []byte, and has the Base64 encoding described in the comment:
// An attribute of type Binary. For example://// "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"//// B is automatically base64 encoded/decoded by the SDK.B []byte`type:"blob"`
In this case, we could look at the option provided by the package user and instead of B, use S and assign the plain JSON string to it.
This should also be done in a similar way for other implementations. It only makes sense for some of them though!
The text was updated successfully, but these errors were encountered:
Currently, when JSON is used as
MarshalFormat
, it will always be converted to[]byte
. This makes the result unreadable as a human, unless interpreted as / converted back tostring
. So for example when using DynamoDB, and a struct is marshalled into a JSON{"Foo":"bar"}
, saved to DynamoDB withgokv
, and then you look at the value via the AWS console, it's justeyJGb28iOiJiYXIifQ==
, the Base64 encoding of the JSON string.That's because in the
dynamodb
implementation we use aawsdynamodb.AttributeValue
for the value where we assign the value to a fieldB
, which is for[]byte
, and has the Base64 encoding described in the comment:In this case, we could look at the option provided by the package user and instead of
B
, useS
and assign the plain JSON string to it.This should also be done in a similar way for other implementations. It only makes sense for some of them though!
The text was updated successfully, but these errors were encountered: