SeaQL / sea-query

🔱 A dynamic SQL query builder for MySQL, Postgres and SQLite
https://www.sea-ql.org
Other
1.08k stars 173 forks source link

Introduce `md5` SQL function #785

Open IgnisDa opened 1 month ago

IgnisDa commented 1 month ago

Motivation

I would like to call the MD5 SQL function. Both Postgres and MySQL have support for it and have the same function signature. SQLite does not have support.

Proposed Solutions

Right now I am using Func::custom.

Additional Information

I am willing to make a PR.

IgnisDa commented 1 month ago

@billy1624 @tyt2y3 I made a PR for the same. Can you take a look?

RichardWGNR commented 1 week ago

The idea is good, but it is not good to create a function for every sneeze. Instead, you can create your own implementation of Func:: or use macros.

Otherwise, the code base will be clogged with functions supported in one DBMS but not supported in another.

IgnisDa commented 1 week ago

@RichardWGNR I'm already using Function::cust but how can this be done with macros? Using Function::cust makes the code very verbose.