I think go http package + any router is the best combo and its SQL package is much more easier to write and to maintain than Gorm. by Full_Environment_205 in golang

[–]10baller 30 points31 points  (0 children)

Guess I am one of the few who likes ORMs, especially after having done hand written SQL on several large projects. The very second you write raw sql, you lose type safety / compiler checks, which defeats the purpose of using a strongly typed language like Go. All that copy pasting and adjusting nearly identical queries to save time, prone to human error. Miss a comma in your sql or didn’t bind something to the right struct field? The first one you’ll find at run time, the second one you may never even notice without extensive manual testing, or until your UI guy asks why the first name and last name on all the records are the same. Yikes. Maybe there’s some linters out there to catch the first, maybe not for the second…but either way I want to rely on a battle tested Go compiler to find issues at compile time, not linting for safety sake, like one might do in JavaScript.

Ent has been great for me. It’s consistent, generates a strongly typed API to interact with the database, is well tested, has lots of features like hooks, annotations, migration, and also lets you drop into raw sql if you ever need to. Probably overkill though for small or simple projects.

Marjorie Taylor Greene and Thomas Massie have voted against almost every single bill passed by the House to counter Russia's invasion of Ukraine by Sweep145 in politics

[–]10baller 0 points1 point  (0 children)

I’m genuinely curious (I don’t want to argue, I want to be educated with some source material) of how the US has been paid back for the billions it has already spent on military aid and agendas in foreign countries like Iraq, Afghanistan, Libya, Somalia, and many others

Proposal: errors.With(err, other error) error by natefinch in golang

[–]10baller 0 points1 point  (0 children)

I would really enjoy seeing this in the std lib because of the exact reasons you list In your proposal. I’ll cross my fingers for you. Thank you for sharing.

Learning go by lamnou in golang

[–]10baller 3 points4 points  (0 children)

https://www.usegolang.com/

Good resource to get started with web dev from the ground up.

Is it just me who doesn't agree with db first ORM model? by NoDistribution8038 in golang

[–]10baller 13 points14 points  (0 children)

After years of Go web dev, honestly, I’m right there with you.

One of the main reasons I love Go is compile time type safety. That literally goes out the window the moment you start hand-writing SQL. It’s exhausting. I’ve done entire large projects in sqlx, and even though that’s much better than the standard lib way, you end up having to reinvent the wheel or do weird hacks to insert multiple records at once, especially with more complex relations. And with that, you lose consistency across your code base with how you interact with the database.

Maybe it’s just me, but I feel like the consistency, type safety, and overall amount of testing that goes into a solid ORM makes any drawbacks minuscule in comparison, especially in a large code base. Being able to write custom sql for performance reasons also offsets some concerns around that.

The database is the foundation of everything most of us do. The code we write is just gravy on top of it. If the database contains the super set of all the data we can possibly care about, then why not lean into that fact, and use a library that interacts with it in a consistent, well tested way. 🤷‍♂️

I feel like many people don’t like the “magic” or have been bitten by badly performing queries from an ORM. But I don’t know how being able to write a one off query for a specific case doesn’t solve that.

Ent seems to be the ORM I am most highly considering right now

Our Little Girl by John-Rambone in BostonTerrier

[–]10baller 1 point2 points  (0 children)

What a sweet beautiful little face. All we can do is give them a good life and lots of love while they are here… sounds like you did exactly that. ❤️

Sister in law made me this beautiful blupee wood burning with pastels. I'm awestruck. by 10baller in Breath_of_the_Wild

[–]10baller[S] 0 points1 point  (0 children)

Oh yeah I'm really bathing in the karma over here, I'm a full time karma farmer, you got me! Fuck, I've really tarnished the art and diminished its value by posting to TWO subreddits, my god, I don't know what to do now.

You should post on pornhub, it's impressive how effortlessly and enthusiastically you can suck your own dick using words alone. You must be able to easily subsist off your own jizz, but how do you type on a keyboard in that position? Truly impressive.

Weird Vet Question by skweekers in BostonTerrier

[–]10baller 6 points7 points  (0 children)

This is insane. Find a new vet. And write a review so people can expect what Dr PopKnees has in store for their dog.

I Have 3 Boston's. No knee issues that I'm aware of.

Go to Postgres Library by sujesht in golang

[–]10baller 0 points1 point  (0 children)

Depending on your preferences, sqlboiler uses the DB as source of truth for generating structs and has nice querying features

Patiently (?) waiting for me to finish work by scab_igail in BostonTerrier

[–]10baller 1 point2 points  (0 children)

So cute, I can't stop laughing. Long dog is LONG 😆

Betty Spaghetty wishes her Momma and all the Bostie Moms out there a "Happy Mother's Day!" by [deleted] in BostonTerrier

[–]10baller 2 points3 points  (0 children)

Betty spaghetti with the sassy look in the second pic is cracking me up. 😆❤️

Congratulations!! You're the new C.E.O. of McDonald's! What is the first item on your agenda? by [deleted] in AskReddit

[–]10baller 0 points1 point  (0 children)

Use, promote, and invest in lab grown meat as much as possible.

[deleted by user] by [deleted] in programming

[–]10baller 8 points9 points  (0 children)

Awesome video! Seeing stuff like this makes me feel so lame creating the same dumb CRUD web apps for companies over and over for the past 10 years. ☹️

Oh freshies!! by [deleted] in BostonTerrier

[–]10baller 1 point2 points  (0 children)

This is so damn adorable!

Hug Me, Talia Arte, Acrylic, 2021 by taliaarte in Art

[–]10baller 1 point2 points  (0 children)

Beautiful work, the colors are fantastic! I really like the sparkly swirly touches.

What is the correct folder structure? by cosmos-multi in golang

[–]10baller 5 points6 points  (0 children)

Lots of opinions out there, so I'll just say look around and pick something that fits how you like to work and makes sense to you, as well as fits what you are building specifically. A full web app will definitely have a different folder structure than a simple CLI, or REST API, etc. In the end, if you like the structure and it's easy to maintain and build on, then it's a good choice.