jet icon indicating copy to clipboard operation
jet copied to clipboard

COALESCE missing in MySQL

Open kblomster opened this issue 3 years ago • 2 comments

Describe the bug The postgres dialect exports COALESCE in postgres/functions.go, but the MySQL dialect lacks it. It's a pretty ubiquitous function, so I believe this is probably a bug.

Code snippet

q := Film.SELECT(
    Film.Title,
    IntExp(COALESCE(Film.Length, Int(0))).AS("length_not_null")
)

Expected behavior I expect COALESCE to be available the MySQL dialect.

As a minor feature request, I think it'd be pretty nice to have the functions listed somewhere on the wiki. Some of them are already on the "Expressions" page, and to be fair a lot of them are just the exact same keywords as in SQL, but when you're new to the library it really helps to just know for sure that they do exist (and especially so when it comes to Jet-specific variants like SUMf() - it shows up in examples, but again, a reference would be nice).

Having typed this out I now realize that in the time it took I could just have submitted a PR instead. :/

kblomster avatar Jun 02 '22 16:06 kblomster

Hi @kblomster . Yeah, it seems those functions are missing for MySQL. Wiki update PR also welcomed.

go-jet avatar Jun 04 '22 10:06 go-jet

Hmm, it looks like they are missing for SQLite as well.

go-jet avatar Jun 04 '22 10:06 go-jet

Fixed with 2.9.0 release.

go-jet avatar Sep 30 '22 12:09 go-jet