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

Small questions / propositions #74

Closed
tafia opened this Issue Dec 30, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@tafia

tafia commented Dec 30, 2015

I have several questions/propositions regarding the current implementation:

  1. questions:
    • Row trait: to me, looking at DbRow (only struct implementing it) it looks more like a Value than an entire row ... I am not familiar with postgresql so it might be an implementation detail (to manage tuples?)
    • is_null: IMHO rust traits should not have is_null functions. Some implementations could be 100% rust and as a result can't be null. What do you think?
  2. propositions
    1. change &Vec<_> to &[_] here ... which eventually leads to not creating a Vec here
    2. rename DbResult: ending with ...Result usually means wrapping around rust Result, which is not the case. Proposition: DbOut or DbRows
@sgrif

This comment has been minimized.

Member

sgrif commented Jan 1, 2016

The answer to both your questions is that SQL is not Rust, and this is ultimately the translation layer between them. As a user, you can think of a row as a tuple, and there's only options, never null. I don't have that luxury in the implementation layer.

We could change Vec to slice there, but there's not really any reason to do so. Vec::new doesn't have a cost associated with it.

The naming of DbResult is because it is wrapping a PG struct called PQResult. Again, since this is an internal facing struct, not a user facing struct, I'd prefer to represent what it is for the implementation.

@sgrif sgrif closed this Jan 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment