Let you create any joinable type easily.
This is the api used by Dict.OneToOne
and Dict.ManyToOne
implementations.
A good other container implementation would be a database table with a forward key in addition to the primary key.
To make your container "joinable", you just need to provide a way to convert it into a Dict
.
Then add a from
, innerJoin
and (optionally) leftOuterJoin
method like this:
import Dict.Joinable
from =
Dict.Joinable.from convertMyContainerToDict
innerJoin =
Dict.Joinable.innerJoin convertMyContainerToDict
leftOuterJoin =
Dict.Joinable.leftOuterJoin convertMyContainerToDict
convertMyContainerToDict : MyContainer a -> Dict comparable a
convertMyContainerToDict =
...
from : (joinable -> Dict comparable a) -> joinable -> (a -> result) -> Dict comparable result
Equivalent to SQL FROM
innerJoin : (joinable -> Dict comparable a) -> joinable -> Dict comparable (a -> result) -> Dict comparable result
Equivalent to SQL INNER JOIN
leftOuterJoin : (joinable -> Dict comparable a) -> joinable -> Dict comparable (Maybe a -> result) -> Dict comparable result
Equivalent to SQL LEFT OUTER JOIN