[dynamodb] Support Text(Un)marshaler interfaces with string
struct tag
#3419
Labels
feature-request
A feature should be added or improved.
string
struct tag
#3419
Is your feature request related to a problem? Please describe.
In my project, I have several enumerators like
I have defined
MarshalText
andUnmarshalText
for each of them, so that they may be serialized as strings in JSON.I want to do the same in DynamoDB, but the only option is to create special DynamoDB marshalers and unmarshalers. The issue is that those special marshalers must be defined in the same package (due to Go's rules), and that is impossible in my project as the package that defines the enumerator type is shared with a client-side WebAssembly application that cannot afford to include an import of AWS SDK.
Describe the solution you'd like
If the struct tag
string
is used, and the type supports theText(Un)marshaler
interface, marshal/unmarshal using that interface.Describe alternatives you've considered
I've switched all my code to https://github.com/guregu/dynamo which supports this feature (even without a special struct tag). This one issue is the only reason I switched.
You could also add a new struct tag
text
in reference to TextMarshalerAdditional context
Full details in Go forum question: https://forum.golangbridge.org/t/implementing-custom-marshalers-unmarshalers-on-imported-types/19680
The text was updated successfully, but these errors were encountered: