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

About changing the API struct, e.g: muti-return with err. #18

Open
atlas-comstock opened this issue Mar 2, 2017 · 2 comments
Open

About changing the API struct, e.g: muti-return with err. #18

atlas-comstock opened this issue Mar 2, 2017 · 2 comments

Comments

@atlas-comstock
Copy link

	iter := query.Iter(conn)
	if iter.Error() != nil {
		log.Panicln(iter.Error())
	}

I think it would be better that iter use muti-return val, which is golang API usually do.

	iter, err := query.Iter(conn)
	if err != nil {
		log.Panicln(err)
	}
@atlas-comstock
Copy link
Author

@m1nor How do u think about it?

@m1nor
Copy link
Contributor

m1nor commented Mar 3, 2017

The correct example is in README

for iter.Scan(&name, &date) {
    //
}
if iter.Error() != nil {
    log.Panicln(iter.Error())
}

Errors in Scan will also be accessible via iter.Error(). I don't think we should break compatibility to separate Iter creation errors and Scan errors.

I'm not closing this issue because it really should be discussed.

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

No branches or pull requests

2 participants