-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(products): Improve API usability. #572
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the package restructuring and the const
s for product names and IDs. This clarifies things and makes it easier to use this correctly.
I'm not (presently, maybe I'll change my mind?) a fan of the type aliases. It makes it seem like there are a bunch of different/new types when they're actually almost all the same productcore.EnableOutput
.
The motivation for that is when a consumer of |
8f6ebe6
to
b6a3af5
Compare
b6a3af5
to
87532e9
Compare
The |
f29cf77
to
7d432c5
Compare
* Add 'EnableOutput' type aliases in each product, so that users of the API don't need to know whether that product has its own EnableOutput or not. Add 'NewEnableOutput' function so that users of the API can easily construct mock output instances. * Add 'ProductName' constant in each product, so that users of the API will have access to the canonical name of the product along with its product_id. * Change package names to conform to Go guidelines (remove underscores). * Change APIs to accept and return by-value instead of by-pointer, as using by-pointer structures can be difficult in generic parameter contexts and the structures involved are small (so there is no real benefit to avoiding by-value passing).
6f4fcf6
to
58647b6
Compare
Add 'EnableOutput' type aliases in each product, so that users of the API don't need to know whether that product has its own EnableOutput or not. Add 'NewEnableOutput' function so that users of the API can easily construct mock output instances.
Add 'ProductName' constant in each product, so that users of the API will have access to the canonical name of the product along with its product_id.
Change package names to conform to Go guidelines (remove underscores).
Change APIs to accept and return by-value instead of by-pointer, as using by-pointer structures can be difficult in generic parameter contexts and the structures involved are small (so there is no real benefit to avoiding by-value passing).