Typed static queries

I'm opening this PR so we can discuss the current state of the implementation.
This looks rather inefficient. We know the size and all parts of the query string at compile-time, so we should e.g. be able to build the final query string in the macro and pass parameters in a more efficient data structure than a List, e.g. a properly sized ArrayBuffer.