Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Inconsistent id's when using boss_db:find #29

Closed
runejuhl opened this Issue Aug 9, 2012 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

runejuhl commented Aug 9, 2012

When using boss_db:find to look for entries with specific id's, boss_db requires the use of integers only (e.g. 2, clashing with the standard type-integer string (e.g. "tag-2") naming scheme.

15> Tag = boss_db:find("tag-2").  
{tag,"tag-2","page",true}
16> Tag:id().                   
"tag-2"
17> boss_db:find(tag, [{id, in, ["tag-2"]}]).
{error,{error,error,<<"22P02">>,
              <<"invalid input syntax for integer: \"tag-2\"">>,
              [{position,<<"33">>}]}}
18> boss_db:find(tag, [{id, in, [2]}]).      
[{tag,"tag-2","page",true}]

So far I've only tried with the pgsql adapter -- I'll try with the mock adapter tomorrow and update the issue accordingly.

Contributor

runejuhl commented Aug 9, 2012

Works fine with the mock adapter:

2> Tag = tag:new(id, "erlang", false).
{tag,id,"erlang",false}
3> Tag:save().
{ok,{tag,"tag-1","erlang",false}}
4> boss_db:find("tag-1").
{tag,"tag-1","erlang",false}
5> boss_db:find(tag, [id, in, [1]]).
[]
6> boss_db:find(tag, [id, in, ["tag-1"]]).
[{tag,"tag-1","erlang",false}]
Contributor

runejuhl commented Aug 10, 2012

Contributor

evanmiller commented Jan 17, 2013

Would love to get this integrated if someone wants to send me a pull request

Contributor

evanmiller commented Jan 25, 2013

Branch merged, closing

@evanmiller evanmiller closed this Jan 25, 2013

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