3 ms·
> Doesn't Go have a similar serialization/deserialization library? There isn't anything as flexible or widespread as serde. > In this case, what about stored
by sa46 4y ago
> Doesn't Go have a similar serialization/deserialization library?
There isn't anything as flexible or widespread as serde.
> In this case, what about stored procedures?
That works but moves logic out of the query and into the DB. Keeping logic in the query is nice to keep server releases independent. The lifecycle of app (and query) code is easier to manage than DB migrations.
> The trouble with templating is that dynamic queries are hard to do in a type-safe manner.
Where-clauses and order-by-clauses are straightforward since the structure of those clauses doesn't affect the structure of the query results. Group-by and table clauses are troublesome since a query might work during codegen but fail at runtime.
- nextaccountic 4y ago> Where-clauses and order-by-clauses are straightforward since the structure of those clauses doesn't affect the structure of the query results. Group-by and table clauses are troublesome since a query might work during codegen but fail at runtime. If you do this kind of analysis (to reject malformed dynamic queries before sending them to the db) I think one can argue you created your own programming language (a DSL but still)