• 2 Posts
  • 122 Comments
Joined 1 年前
cake
Cake day: 2023年8月8日

help-circle






  • Well. I did read up on the “XY” problem and apparently you assume that what I want to do is somehow bad practice.

    To elaborate more on the problem: I am writing an axum backend which (like other backends) needs to do stuff in the database. As some endpoints update the database (and sometimes over multiple sql statements) I want to pass around the transaction as this embodies the connection I am using to update the database.

    To separate the axum stuff (parameters, urls and whatnot) from the actual database logic, I’ve first pulled out all the database interactions into separate functions. Because those functions are logically groups (e.g. stuff happening with invoices, others with contacts etc), I thought it was a good idea to create a “dao” struct (and agreed: my OO brain kicked in here which might be debatable). This would group the interactions for each logical domain into a short-lived data access struct.

    To prevent passing around the transaction/connection, i wanted to pass that along during construction, so the functions in the DAO could just access the connection when needed.

    Non “OO” would be fine to be honest (just having all the DAO as functions in a separate package).

    Sorry, no code, not at the computer atm.

    (And yes, I am aware that rust is not OO, put away the pitchforks please 🙏)









  • I am currently using it from a backend to generate pdfs.

    One thing that prevents me from letting users build their own templates is the scripting capabilities. A joker creating an endless loop could block the whole server.

    What would be nice is a “safe” mode in which no access to the file system (include and sorts) and limited runtime makes it safe to let users build their own templates.






  • Russia, as imperialistic aims it may have, have no intentions, not capabilities of invading Poland, Lithuania or Finland.

    Hey, I’ve heard that before in 2014. You know the three day invasion?

    And because I really think you are a troll: the best part is, NATO has yet to set foot on the ground, while Russia is running to rogue countries like NK.

    Besides, Ukraine being “awkwardly neutral” did not stop Putler from invading, did it?

    You use a lot of words, but a foundation of your “facts” are blatantly missing.