Commit 813ed8a
committed
experiment: typed enums with interfaces.
Implement typed enums in go by changing the type from `any` to an interface.
The interface is defined by a single private method to ensure that exactly one
variaent of the enum is populated. We also implement a custom UnmarshalJSON to
choose the correct implementation to unmarshal into based on the discriminator
field.1 parent 1866144 commit 813ed8a
1 file changed
+75
-1
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments