I'm just learning Rust, with a predominantly Python with C++ & JS background.
I've put together a small utility called pg_gensql that generates INSERT statements from an SQL statement. It works, but there are a couple of bits that feel a little uncomfortable/could do with some improvement.
In serialize_for_insert, there is a function that dispatches to other typed functions based on a byte buffer and a discriminator. It feels very repetitive at the moment, especially with scalar and vector versions. Is there something I can do better here? If the answer is macros, I'll need to learn the basics first.
In raw, I implemented a
try_into function for
FromSql, but couldn't formally implement
TryInto, as it failed with "conflicting implementations of trait
Raw is itself an implementation of
FromSql. Is it possible to get that to work?