A new convenience function #9

Closed
erikd opened this Issue Dec 6, 2012 · 4 comments

Comments

Projects
None yet
2 participants
@erikd
Contributor

erikd commented Dec 6, 2012

I often find myself matching a foreign key from a table with a Int64 and keep writing something like:

u ^.UserId ==. val (Key (PersistInt64 i))

Instead, it would nice to have something like this which works like the present function val:

valkey :: Esqueleto query expr backend =>
                Int64 -> expr (Value (Key backend entity))
valkey i = val (Key (PersistInt64 i))

so the above could be written as:

u ^.UserId ==. valkey i
@meteficha

This comment has been minimized.

Show comment Hide comment
@meteficha

meteficha Dec 6, 2012

Owner

Looks ok, could you send a pull request? =)

Also, may I ask why you're using Ints directly instead of just using Keys?

Owner

meteficha commented Dec 6, 2012

Looks ok, could you send a pull request? =)

Also, may I ask why you're using Ints directly instead of just using Keys?

@erikd

This comment has been minimized.

Show comment Hide comment
@erikd

erikd Dec 6, 2012

Contributor

The Int64 comes from a Yesod Route parameter.

Contributor

erikd commented Dec 6, 2012

The Int64 comes from a Yesod Route parameter.

@meteficha meteficha closed this in aa2c207 Dec 14, 2012

@meteficha

This comment has been minimized.

Show comment Hide comment
@meteficha

meteficha Dec 14, 2012

Owner

Fix released on esqueleto 1.0.1 =).

Owner

meteficha commented Dec 14, 2012

Fix released on esqueleto 1.0.1 =).

@erikd

This comment has been minimized.

Show comment Hide comment
@erikd

erikd Dec 15, 2012

Contributor

Cool, thanks!

Contributor

erikd commented Dec 15, 2012

Cool, thanks!

bradediger pushed a commit to bradediger/esqueleto that referenced this issue Apr 25, 2017

Merge pull request #9 from qrilka/patch-1
Use correct `in_` quoting in haddock code block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment