walkable-server / walkable

A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
https://walkable.gitlab.io/
Eclipse Public License 2.0
444 stars 15 forks source link

Cannot join by any non-integer column #155

Closed zerg000000 closed 5 years ago

zerg000000 commented 5 years ago

if _id is not a integer/long,

the join statement will failed.

query

[{[:friend/by-id "26289c88-efb7-4834-9774-b0666950884a"]
                     [:friend/name
                      {:friend/pets [:pet/name]}]}]

generated sql

["SELECT ("friend"."_id") AS "friend/_id", ("friend"."name") AS "friend/name" FROM "friend" WHERE (("friend"."_id")=(?))" "26289c88-efb7-4834-9774-b0666950884a"]
["SELECT ("pet"."name") AS "pet/name", ("pet"."friend") AS "pet/friend" FROM "pet" JOIN "friend" ON "pet"."friend" = "friend"."_id" WHERE (("pet"."friend")=(26289c88-efb7-4834-9774-b0666950884a))"]

floor-plan

{:idents [:friend/by-id :friend/_id]
 :joins {:friend/pets [:friend/_id :pet/friend]}}
myguidingstar commented 5 years ago

sorry for this late PR @zerg000000 can you help testing it? Also, it would be great if you can add some integration test