We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Unmarshal takes two arguments of which one is a return type. So it should still be possible to compose it without the user making a special function.
func getUsername(u *User) (string, error) { if u.Username == "" { return "", fmt.Errorf("no username") } return u.Username, nil } username, err := deriveCompose(json.Unmarshal, getUsername)(buf) func deriveCompose(f func([]byte, interface{}) error, g func(*User) (string, error)) func([]byte) (string, error) { return func(buf []byte) (string, error) { u := new(User) if err := f(buf, u); err != nil { return "", err } return g(u) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Unmarshal takes two arguments of which one is a return type. So it should still be possible to compose it without the user making a special function.
The text was updated successfully, but these errors were encountered: