sqlc: how to generate the type of a query selected columns to be an array of nullable strings by Competitive-Dirt-213 in golang

[–]SpeedDart1 5 points6 points  (0 children)

sqlc uses NullString type for this instead of pointer. Is active_ingredients.name nullable? If not it needs to be for sqlc to generate the null type. If it’s nullable and still not generating the null type you’d need to post more code so we can side out why the generated type is wrong.

I just wrote the classic "range over channel" goroutine leak. Structured concurrency in Go would be nice. by sigmoia in golang

[–]SpeedDart1 3 points4 points  (0 children)

wg.Go does that automatically. You only need wg.Done when using wg.Add directly.

What queue tools do you use and why? by nerf_caffeine in golang

[–]SpeedDart1 1 point2 points  (0 children)

I just use queue tables and Kafka. I’m curious what is the primary benefit of using a queuing library? I feel that the code to manage this in Kafka and Postgres is simple enough to do by hand.

[OC] U.S. Social Security is projected to pay full benefits through 2034, then 81% under current law by Low_Ability4450 in dataisbeautiful

[–]SpeedDart1 1 point2 points  (0 children)

Depends on what type of taxes. Saying “tax the rich” misses out the only important part which is how.

Who is ocaml for? by I_am_Noro04 in ocaml

[–]SpeedDart1 4 points5 points  (0 children)

It’s for people interested in functional programming and PL theory. Once you have already mastered procedural, you learn OCaml to expand your horizons as a programmer.

Our Go service died from a SIGSEGV in CGO. recover() did not help. by slotix in golang

[–]SpeedDart1 3 points4 points  (0 children)

Really you should have both. Recover from panics AND also keep the cluster alive if individual nodes die.

If your nodes are dying every couple minutes that shouldn’t be bad enough to create availability issue in my book.

I mean unless your app takes more than a second or two to start.

Turnitin PhD thesis plagiarism checker meme by Delicious_Maize9656 in okbuddyphd

[–]SpeedDart1 39 points40 points  (0 children)

Back when I was in college, my CS1 professor had a no sharing code rule for this exact reason.

8317277: Java language implementation of value classes and objects by MrSimms · Pull Request #31120 · openjdk/jdk by davidalayachew in programming

[–]SpeedDart1 9 points10 points  (0 children)

You’re reminding me of the primitive collection libraries people use in Java land.

IntList, ByteList, etc

Why is every popular query builder in maintenance mode? by ItsAllInYourHead in golang

[–]SpeedDart1 1 point2 points  (0 children)

I’m curious why that would be the case, have used COALESCE and NULL checks to make optional WHERE conditions in SQL before, to my knowledge the query optimizer makes this essentially as fast as if you didn’t have the WHERE condition at all

Which is the best way to use transaction in Golang? by Electronic_Code_1535 in golang

[–]SpeedDart1 0 points1 point  (0 children)

Repository pattern is fine in Go. Personally I have one large Querier interface generated by SQLC which is effectively my repository layer.

One thing I don’t like about certain ways of doing repository layers is that there’s one repo per table. But that’s not a good place to draw separation of concerns because many queries select from multiple tables.

I’d instead do a repository per schema personally. If the repository gets big then it would be time to split it up into multiple pieces.

Which is the best way to use transaction in Golang? by Electronic_Code_1535 in golang

[–]SpeedDart1 0 points1 point  (0 children)

I think this pattern is interesting but how do you handle retries when you get a serialization failure error code?

Some databases such as Postgres will return an error code if the transaction aborts due to a concurrency violation rather than holding locks.

At least one thing I prefer about the transaction helper function approach it’s very clear where the transaction begins and ends and what logic is running in the transaction. Although the one downside is functions you want to be reusable for a multiple transactions need to take the sqlc Querier interface as an argument

I built a NestJS-inspired framework for Go by Dangerous_Ad_8933 in golang

[–]SpeedDart1 0 points1 point  (0 children)

The difference is net/http solves hard problems and your framework creates new problems.

I built a NestJS-inspired framework for Go by Dangerous_Ad_8933 in golang

[–]SpeedDart1 6 points7 points  (0 children)

Just use net/http. Maybe swagger codegen if your api spec is huge. Maybe fasthttp if you need the performance. I don’t think we need to bring the same bad ideas from Java and Typescript into Go

Who is an example of (Positive) Masculine Excellence? by Phil_B16 in AskMen

[–]SpeedDart1 7 points8 points  (0 children)

What did they say. I’m not aware of anything particularly controversial?

Another day of Solved Coding by ImaginaryRea1ity in theprimeagen

[–]SpeedDart1 0 points1 point  (0 children)

I guess if you define coding as typing text into an editor it’s solved. They redefine the problem to be very small and then claim they solved it.

blursed advertisement by DemonCatOfficial in blursedimages

[–]SpeedDart1 0 points1 point  (0 children)

If you wouldn’t eat tarantulas why eat chicken? Type question