Our great sponsors
-
SQL code generator (aka inspect a database or SQL files to generate data models). You have the option of using something like volatiletech/sqlboiler which looks at the a physical database and generates code based on the schema. Or SQLC which is an amazing and fast project.
-
I personally do the no ORM approach, often combining query-builders with SQL drivers (sqlx + squirrel) as to avoid raw SQL in my code. You can build composable query this way and it lessens the likelihood of someone accidentally creating a SQL injection vulnerability.
-
SonarLint
Clean code begins in your IDE with SonarLint. Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.
-
You just write more queries and sqlc will make ad hoc types for you. I have a bunch of code here: https://github.com/spotlightpa/almanack/tree/master/internal/db https://github.com/spotlightpa/almanack/tree/master/sql/queries
-
Hello, I want to communicate with a database in my go API. My API is for a website that allows you to track finances and budgets, so the reason I need a database is to store the user's expenses and allow them to search and find each one and which one is costing them the most. I also am going to implement login soon, but I don't think that matters for now. I'm now stuck on how to communicate with my database (Postgres). Should I go with an ORM like gorm, database/sql package, sqlx, or any others? Advice is appreciated
-
https://github.com/jmoiron/sqlx and github.com/lib/pq are pretty solid, this is what i go to.
-
-
This way: https://github.com/uptrace/bun, I prefer in all cases with PostgreSQL
-
InfluxDB
Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.
-
Check out https://entgo.io/ I like the approach to define an entity schema first and let handle entgo the query part.
-
sqload
Load your SQL queries from .sql files instead of writing the SQL code in your Go source files.
sqload
-
Yesqlgoyesql
-
Use sql builder https://github.com/go-jet/jet.
-
SQL Builders (think squirrel or goqu)
-
SQL code generator (aka inspect a database or SQL files to generate data models). You have the option of using something like volatiletech/sqlboiler which looks at the a physical database and generates code based on the schema. Or SQLC which is an amazing and fast project.