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

add Deref() and GetValue() funcs #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Dentrax
Copy link

@Dentrax Dentrax commented Nov 1, 2022

Signed-off-by: Furkan furkan.turkal@trendyol.com

I tried to use pointer package first time, but unfortunately it couldn't cover my needs for the generics in the first place. So, this PR introduces 2 new functions for generics:

  • Deref(): Like Get() but slightly different. It returns any. Which we can nil-check.
  • GetValue(): Like the functions in value.go, but using generics to deref under the hood. Only supports primitive types.
  • Also updates go.mod to 1.19.

Thanks to @peterhellberg for being helpful on Go Slack! Find his demo: https://go.dev/play/p/bAwvt92thoS

/cc @AlekSi

Signed-off-by: Furkan <furkan.turkal@trendyol.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant