A codec for Go structs with support for chainable encoding/decoding hooks.
- Provide a uniform codec by combining mapstructure and structs.
- Make encoding/decoding hooks chainable.
$ go get -u github.com/RussellLuo/structool
Why to use
Why to make a fork of
fatih/structs has been archived, but it does not support encoding hooks yet.
Why chainable hooks may be useful
structssupport hooks in the form of a single function. While this keeps the libraries themselves simple, it forces us to couple various conversions together.
Chainable hooks (like HTTP middlewares), on the other hand, promote separation of concerns, and thus make individual hooks reusable and composable.
Check out the Godoc.