-
Notifications
You must be signed in to change notification settings - Fork 60
pool: implemented Role Stringer interface #406
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
pool: implemented Role Stringer interface #406
Conversation
255ca5c
to
fa6c6f9
Compare
I suggest to use diff --git a/pool/const.go b/pool/const.go
index 7ec239f..22bff4f 100644
--- a/pool/const.go
+++ b/pool/const.go
@@ -30,8 +30,12 @@ const (
// Role describes a role of an instance by its mode.
type Role uint32
+//go:generate stringer -type Role -linecomment
const (
- UnknownRole Role = iota // A connection pool failed to discover mode of the instance.
- MasterRole // The instance is read-write mode.
- ReplicaRole // The instance is in read-only mode.
+ // A connection pool failed to discover mode of the instance.
+ UnknownRole Role = iota // unknown
+ // The instance is read-write mode.
+ MasterRole // master
+ // The instance is in read-only mode.
+ ReplicaRole // replica
) |
6a062bf
to
7135806
Compare
@oleg-jukovec i generated Stringer face by stringer library. since it can only cut prefixes, I was forced to rename the roles, since they are not specified externally, this will not change the user interface |
95e6133
to
60e0b2f
Compare
Unfortunately, we could not change naming because it will break backward compatibility. But the ‘stringer’ could generate custom strings, see ‘-linecomment’ option for the ‘stringer’ and my patch more carefully. |
60e0b2f
to
f1d88dc
Compare
i will open new pr instead amend fixes |
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.
Please, fix red tests.
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.
Thank you for the patch! Please see couple of nits below.
Also, don't forget to squash the commits after the work is done. And please change the line Related issues: #405
to the Closes #405
, so the issue could be closed automatically after the merge.
implemented Role Stringer interface for human-readable printing
44713e0
to
e71888f
Compare
@DerekBum thanks, I accepted the proposed changes and squashed all commits |
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.
Thanks for the patch!
implemented Role Stringer interface for human-readable printing
Closes: #405