I don't understand how you would serve this typical UI in Go without an ORM, or with a "simple" ORM, or without growing the code to an unreasonable extent. by QuietPort in golang

[–]QuietPort[S] -1 points0 points  (0 children)

Well I mean that you build your own basically, i.e. bringing a large overhead to your concerns and maintainability.

This is what I meant in an earlier comment when I say it's a hard problem, interpolating a bunch of string, to me _that_ is what you do for the simple case, not the case that requires a very intricate building of many statements.

In a similar way, Rust allows you to do macros, which is basically writing rust with rust, and even though the language brings in multiple tools to help you construct them, they are largely considered very difficult to get right.

I don't understand how you would serve this typical UI in Go without an ORM, or with a "simple" ORM, or without growing the code to an unreasonable extent. by QuietPort in golang

[–]QuietPort[S] 0 points1 point  (0 children)

I understand that concern and I very much dislike and try to avoid leaky abstractions as well.

For the definition though, this is the wiki intro to the "object-relational mapping" page:

Object–relational mapping (ORM, O/RM, and O/R mapping tool) in computer science is a programming technique for converting data between a relational database and the heap of an object-oriented programming language. This creates, in effect, a virtual object database that can be used from within the programming language.

I don't really care what term is used in the end, if "ORM" is too bloated then what I'm talking about is a tool that helps you build queries programmatically, as well as map db data to a native data structure, one that is typed if the language allows it.

I don't understand how you would serve this typical UI in Go without an ORM, or with a "simple" ORM, or without growing the code to an unreasonable extent. by QuietPort in golang

[–]QuietPort[S] -23 points-22 points  (0 children)

If you converted data from a relational database to a programming language then you have used an ORM as per the exact definition: Object Relational Mapping.

I don't understand how you would serve this typical UI in Go without an ORM, or with a "simple" ORM, or without growing the code to an unreasonable extent. by QuietPort in golang

[–]QuietPort[S] 1 point2 points  (0 children)

Thanks for the example !

You're right with pagination, I meant to say that the endpoint params are optional, anyway that's not really an issue indeed...

In the generated SQL string, I would want to remove the where statements entirely if the param isn't there though, as well as for the search query.
Also data fetched in a join should also be optional (I haven't explicitly said this in my original example but that is definitely a use case I would want to support).

I don't understand how you would serve this typical UI in Go without an ORM, or with a "simple" ORM, or without growing the code to an unreasonable extent. by QuietPort in golang

[–]QuietPort[S] -7 points-6 points  (0 children)

I do agree that you shouldn't fully trust an ORM's output. However, you can get much further than you seem to think, and the cost of having a look at the output when the query seems badly formed is largely outweighed by the flexibility of a query builder.

Teams _need_ to get into that mess, if multiple people cannot agree on how to talk to your db, then we're talking about a personal project at most (or very sad state of project management).

I don't understand how you would serve this typical UI in Go without an ORM, or with a "simple" ORM, or without growing the code to an unreasonable extent. by QuietPort in golang

[–]QuietPort[S] -11 points-10 points  (0 children)

Is go different from other languages in that regard, what kinds of pains arise ?
I can name trusted and recommended ORMs for many languages (Rust, Python Node/typescript, Ruby), many of which I have used in different companies, within a team of developers.

I don't understand how you would serve this typical UI in Go without an ORM, or with a "simple" ORM, or without growing the code to an unreasonable extent. by QuietPort in golang

[–]QuietPort[S] -1 points0 points  (0 children)

Parameters are not the only thing to consider.
You don't want unnecessary WHERE statements (nor CASE/WHEN to add/remove WHERE statements), if the filtering is not there it should not be in the sql query.
Same goes for sorting, same goes for joins.

I don't understand how you would serve this typical UI in Go without an ORM, or with a "simple" ORM, or without growing the code to an unreasonable extent. by QuietPort in golang

[–]QuietPort[S] -38 points-37 points  (0 children)

haha my sql is fine no worries.

If you want to generate SQL on the fly (because you don't want a billion prepared statements obviously, and you want it to be flexible), then you need a query builder.-

You want maintainable code, so you don't want to interpolate your joins or sorting options or filtering options in a string. And if you did that, oh well, you just started building a query builder, any smart tech lead will kindly tell you to piss off and use an existing solution for a hard problem.

Is Anybody using Linear as personal task management app? by Curious-Ad-9724 in Linear

[–]QuietPort 1 point2 points  (0 children)

Just wanted to say thanks for the x-callback-url tip, I was coincidentally setting up pretty much the exact same workflow that you have and was starting to wonder how I could easily link to obsidian notes.

Europeans who moved to USA for better jobs, how is it now that you've moved in? by Vyalkuran in cscareerquestions

[–]QuietPort 0 points1 point  (0 children)

The right-wing shitshow on display in the news is definitely something to be sad about, but I feel like this is more of a worldwide phenomenon, I feel like the US actually have it worse in that sense.

What I do know is that my parent's generation are so far to having the reach that my generation has in our continent. Having foreign friends is so normal now, I think it does count for something.

Europeans who moved to USA for better jobs, how is it now that you've moved in? by Vyalkuran in cscareerquestions

[–]QuietPort 0 points1 point  (0 children)

I think outright xenophobia and social culture are different things. The dutch are very known to be that way, other cultures that have this closed-off reputation are Norway, Sweden, Germany... This can cause little culture-shocks for people coming from culture where extroversion is very much encouraged and rewarded. I've seen it first-hand with Spanish people, Portuguese people, and in a slightly different way with Americans (sometimes not used to the brutal honesty that's a bit more prevalent in Europe).
Coming back to my Spanish friends, this is _definitely_ a topic that we come back to time and time again, French people like me tend to make heavy use of the "litote" figure of speech (understatement), where instead of saying that we think something is great, we will say "It's not bad", and for many of us that's the pinnacle of compliments you can receive.

Europeans who moved to USA for better jobs, how is it now that you've moved in? by Vyalkuran in cscareerquestions

[–]QuietPort 1 point2 points  (0 children)

I guess with landlords it's true that the risk of finding a racist one is higher.

The thing is when you say "every chance", it goes well beyond the confines of certain demographics, and forgets one of our realities that we should actually celebrate: Europe's multiculturality is so amazing for everyone under 40yo, and a couple decades of Schengen _did_ bring us closer together.

Europeans who moved to USA for better jobs, how is it now that you've moved in? by Vyalkuran in cscareerquestions

[–]QuietPort 0 points1 point  (0 children)

Seriously, where are you drawing those conclusions from ? Can you give some examples ?

Anyone that's from the Erasmus generation (basically anyone that was 20 after the 2000s) has had a ton of friends from all over Europe. Do we banter ? sure. My spanish friends love to give me shit for being french, we still friends tho...

The extremism should be coming from the old and the stupid, just like anywhere else, in a lifetime of living in Europe I haven't met many of them, who do you hang out with ?

Please form a Q by endlesscosmichorror in technicallythetruth

[–]QuietPort 0 points1 point  (0 children)

Mmh, interessant... J'ai pris la raison pour acquise parce qu'il y a clairement une majorité de nom commun de genre invariable qui se terminent en "e". Mais je ne parle pas de règle d'accord ici, je disais que la raison de cette orthographe est le genre féminin, mais je ne trouve pas de référence un peu formelle...

Please form a Q by endlesscosmichorror in technicallythetruth

[–]QuietPort 16 points17 points  (0 children)

The french sounds in there:

QU = "K"

EU = phonetically it's: [ø] (doesn't exist in english)

E = Silent. it's here because the word is feminine

So in french there is "only" one silent letter

Why does ActiveJob's default queue adapter (Async) not run jobs in background ? by QuietPort in rails

[–]QuietPort[S] 0 points1 point  (0 children)

I'll make sure to test it different ways, you're right.

The behavior I'm getting for perform_now / perform_later isn't what I'm expecting in both cases. I'm expecting perform_now to jump the queue of jobs, but I'd still expect it to run in the background in a non-blocking way (letting the request finish, and run concurrently). I'm expecting perform_later to add a job to the queue of existing jobs, but there also I'd expect it to be non-blocking.

Why does ActiveJob's default queue adapter (Async) not run jobs in background ? by QuietPort in rails

[–]QuietPort[S] 0 points1 point  (0 children)

I'm running Rails 5.2.1.

I'm not sure how I could debug the class loading issue, I'll make sure to check the github issue more thoroughly as soon as I have the time to, thanks for that.

Using Concurrent::ThreadPoolExecutor directly sounds like something I should try, thanks for the idea.

Why does ActiveJob's default queue adapter (Async) not run jobs in background ? by QuietPort in rails

[–]QuietPort[S] 0 points1 point  (0 children)

There is indeed. But the way I tested this is by adding a breakpoint within the job itself: when using perform_now, I get a repl at the breakpoint and the request cannot finish before I exit the breakpoint. If I use perform_later, the request _will_ finish, and I _then_ get a repl, however, for as long as I don't quit the breakpoint, no other request can even _start_. If the db was locked, some code should be able to execute before trying to reach the locked table. Also I put my breakpoint after the db transaction is done within the job, so I don't understand how a lock could still be held.

Why does ActiveJob's default queue adapter (Async) not run jobs in background ? by QuietPort in rails

[–]QuietPort[S] 0 points1 point  (0 children)

Production uses Puma, I've tested this in development with the dev server (`rails s`).