Fork me on GitHub
#sql
<
2017-08-08
>
cycle33714:08:39

does anybody here use korma ?

cycle33714:08:41

I'm doing a select over multiple tables and I need the return of the korma.select to give me some predefined value if a field is nil

cycle33714:08:51

I don't want to parse text and str/replace

cycle33714:08:55

which is lame

cycle33714:08:39

thing is I have an :approved field with returns true or false or nil in case there's nothing to join on (i've been using nil as a pending value)

cycle33714:08:09

but it gets evaluated same as false in a framework that I'm using

cycle33714:08:38

and I want to have like a default field value that's pending if the select over a joined table has no entries

cycle33714:08:46

instead of korma.select's nil

donaldball14:08:47

This sounds like a simple post-processing fn; map an update over your results. You could also look to use the sql COALESCE fn to return something other than NULL in your query.

cycle33714:08:58

i used sqlfn (ifnull ....)

cycle33714:08:14

coalesce sounds better i think