You may think you've seen all the ways you can write a SQL query library, but Yesql is elegant and novel (AFAIK): https://github.com/krisajenkins/yesql