Show HN: Go 1.22 range functions with database/sql https://ift.tt/fuqsEtP

Show HN: Go 1.22 range functions with database/sql Hello HN! I published a package exploring how to use the experimental range functions coming to Go 1.22 with database/sql to stream values in and out of SQL databases. One interesting benefit of range functions I found is they enable automatic resource management (no risk of forgetting to close a sql.Rows, or missing a call to Err to check errors). The use of generics adds type safety and simplifies exchanging values between the Go application and the database. The resulting code is also quite efficient, the compiler can inline the call sites that create the range functions, which helps escape analysis and allow most values to be allocated on the stack. Let me know if you have any feedback, I hope it will be useful! https://ift.tt/SRw5voV January 17, 2024 at 12:31AM

Komentar

Postingan populer dari blog ini

Show HN: Interactive exercises for GNU grep, sed and awk https://ift.tt/OxeFwah

Show HN: Create demos & guides just with a simple prompt https://ift.tt/HfWo3mz