[web-devel] [Yesod][Persistent] FooIdEq,FooIdIn

Aur Saraf sonoflilit at gmail.com
Sun Mar 13 21:48:49 CET 2011


Hello Michael and everyone,

I think that it is very repetitive to need to specify what actions can
or cannot be done on every field.

I think it would better be made part of the FieldType, at least
letting you specify defaults that can be edited in the field
specification.

Also, I definitely see a need for FooIdEq as I'm toying with adding
support for more complicated SQL right now.


What I have working in a toy hacked environment:

> showQuery $ do
>   selectAll (undefined :: Pet)       -- hopefully I'll make it possible to select specific fields
>   where_ PetTypeEq Dog            -- eventually I'll probably get "PetType .== Dog" to work
>   where_ PetOwner PersonAgeLt 12
"SELECT * FROM Pet WHERE Pet.type=? AND Person.age<? AND
Pet.id=Person.id JOIN Person"

I'm currently modifying the TH to support generating

> persistFilterToJoins :: Filter val -> [(SomePersistEntity, SomePersistEntity)]

That I need in order to do this in more than a toy environment.

When there'll be something half worth showing, I'll upload to git and
invite everyone to help (since this is mostly over-my-head Haskell...
I've been learning a lot from it).

On Sat, Mar 12, 2011 at 8:46 PM, Michael Snoyman <michael at snoyman.com> wrote:
> On Sat, Mar 12, 2011 at 3:07 AM, Katsutoshi Itoh <cutsea110 at gmail.com> wrote:
>> Hi
>>
>> I had often wanted FooIdIn, FooIdEq on Foo Persistent type.
>> Would you support this by default?
>>
>> from japan.
>
> As Max said, glad to see that you're safe.
>
> For FooIdEq: I don't think there is any need, since it can be
> expressed more succinctly with the "get" function. As for FooIdIn:
> this *was* a recently requested feature. Maybe we can get it in for
> the next release. I think it would make sense to add the In attribute
> to the entity itself, eg:
>
> mkPersist [$persist|
> Person In
>    name String
>    age Int
> |]
>
> Any objections?
>
> Michael
>
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
>



More information about the web-devel mailing list