-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename constants to make adjectives like "Default" or "Min" suffix in…
…stead of prefix One last last-second API change I wanted to float: rename constants so that adjectives like "Default" and "Min" become name suffixes instead of prefixes. So e.g. `DefaultFetchCooldown` becomes `FetchCooldownDefault`. The primary benefit in my mind is that constants that are related to each other in referencing the same value, now sort together alphabetically. Take for example: const ( FetchCooldownDefault = 100 * time.Millisecond FetchCooldownMin = 1 * time.Millisecond Previously, these were organized together, but didn't actually line up if the list were to be sorted. Another benefit is better autocomplete: when trying to autocomplete a default value, previously to disambiguate from all the other ones you'd have to type the whole word "Default" which is common to all of them. But with the prefix switched to a suffix, if looking for say the default for max attempts, you'd get a match within just a couple characters. Probably the most contentious part of this is that `QueueDefault` flips, which is the one constant that's actually referenced a fair bit from user code. e.g. Queues: map[string]river.QueueConfig{ river.QueueDefault: {MaxWorkers: 100}, }, This may be a tiny bit worse in terms of how it rolls off the tongue, but I've been staring at it a while now, and I think it's something you'd get used to. Also, it's kind of nice how it fits better with names like `QueueConfig` which are present in the same invocation.
- Loading branch information
Showing
37 changed files
with
171 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.