Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Inconsistent id's when using boss_db:find #29

Closed
runejuhl opened this Issue · 5 comments

2 participants

@runejuhl

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.

@runejuhl

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}]
@runejuhl

It seems that the following commit fixes it: gwitmond/boss_db@5974c73

@evanmiller
Owner

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

@evanmiller
Owner

Branch merged, closing

@evanmiller evanmiller closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.