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

Refactor: extract.IntoStructPtr should allow passing non-structure recipients #421

Open
outcatcher opened this issue Sep 6, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@outcatcher
Copy link
Contributor

Currently there are some cases where returning result can be simplified in case IntoStructPtr allows passing non-structure recipients, e.g. *string.

Before:

	var res struct {
		ID string `json:"scaling_group_id"`
	}
	err = extract.Into(raw.Body, &res)

After:

 	var id string
	err = extract.IntoStructPtr(raw.Body, &id, "scaling_group_id")

In some built-in libraries (e.g. sql) there is no difference between structure and non-structure recipients: https://pkg.go.dev/database/sql#Rows.Scan

On the other hand, this function is called IntoStructPtr, not IntoPtr or IntoAnyPtr, so current function list to be discussed.

@outcatcher outcatcher added the enhancement New feature or request label Sep 6, 2022
@Aloento
Copy link
Member

Aloento commented Sep 7, 2022

agree

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

No branches or pull requests

2 participants