Show HN: A Discord/Slack bot to watch HN comments
newsbutler.xyz5 pointsby maattdd0 comments
db_message = Model.save_new_message!(@conf.db, DbButler::Hn, item, DbState::Processing)
Than I have a Model module with all the interactions with the DB def self.save_new_message!(db, butler, external_id, state) : Message
sql = {{ read_file "./db/save_new_message.sql" }}
db.query_one(sql, butler.to_s.downcase, external_id, state.to_s.downcase, as: Message)
end
(thanks to Crystal ability to read a file at compile time - I can write raw SQL in a file with syntax highlithing and maybe typesafe if I connect the DB to the editor)