Skip to content
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

Replace most helpers with a generic ToPointer function #489

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

fgsch
Copy link
Member

@fgsch fgsch commented Nov 17, 2023

Discussed with @Integralist .

@Integralist Integralist added the enhancement New feature or request label Nov 17, 2023
@Integralist Integralist merged commit d9cb56c into main Nov 17, 2023
2 checks passed
@Integralist Integralist deleted the fgsch/unify-pointer-helper branch November 17, 2023 11:30
// Bool is a helper that returns a pointer to the bool value passed in.
func Bool(v bool) *bool {
// ToPointer converts T to *T.
func ToPointer[T string | int | uint | uint8 | bool | CacheSettingAction | Compatibool | ERLAction | ERLLogger | ERLWindowSize | RequestSettingAction | RequestSettingXFF | S3AccessControlList | S3Redundancy | S3ServerSideEncryption](v T) *T {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why you specify all these types rather than using any?

I wonder also if you could use the ~ sigil on the primitive types to get the underlying types? If not any then ~string | ~int | ~uint | ~uint8 | ~bool?

Copy link
Member

@joeshaw joeshaw Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha never mind, I just saw the follow-up PR. (#490)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants