scany
pgx
Our great sponsors
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
scany
-
Are there any decent ORMs in Golang?
When I don't use one, I'm typically using SQLx or (if using Postgres) pgx with scany https://github.com/georgysavva/scany (slightly better API than SQLx and great performance since you can use the native interface from pgx if desired whereas many database drivers only offer the text-based interface).
-
How do you handle scanning of db.Rows?
If you want something like sqlx and you already know you're using pgx, a better choice is probably https://github.com/georgysavva/scany since you can use the native interface and get the same key features.
-
Building a Simple TODO App with Gin-gonic in Zerops: A step-by-step Guide
github.com/georgysavva/scany (v1.1.0)
-
SQL Query Strategy for complex structs
I like to use pgxscan from https://github.com/georgysavva/scany
-
Does gorm worth learning?
There's also bqb. We use it in production at our company -- much better than raw SQL. If you couple it with something like scany then you get more of the ORM benefits without the complexity.
pgx
-
The DDD Hamburger for Go
The infrastructure layer contains the concrete implementation of the repository domain interface ActivityRepository in the struct DbActivityRepository. This repository implementation uses the Postgres driver pgx and plain SQL to store the activity in the database. It uses the database transaction from the context, since the transaction was initiated by the application service.
-
Building RESTful API with Hexagonal Architecture in Go
For building the RESTful Point of Sale service API, I've considered and selected a combination of technologies that would work seamlessly together. For handling HTTP requests and responses, using the Gin HTTP web framework would make sense because I think it seems complete and popular among Go community too. To ensure data integrity and persistence, I'm using PostgreSQL database with pgx as the database driver, the reason I choose PostgreSQL because it is the most popular relational database to use in production and offers efficient Go integration. I'm also implementing caching using Redis with go-redis client library, which provides powerful in-memory data storage capabilities.
-
Working with postgres in GO.
If you are willing to commit to working only with Postgres, I highly recommend pgx. Be sure you get the latest version github.com/jackc/pgx/v5. This gives you the full power of interacting with Postgres without going through an intermediate lowest-common-denominator library.
-
How to Use Iris and PostgreSQL for Web Development
It uses pg package and pgx driver under the hood.
-
Could I get a code review?
Starting off, is there any reason you're calling out to the CLI, instead of just using a Postgres driver like pgx? Shelling out to the command line should always be a last resort where possible as a software engineer.
-
Why elixir over Golang
For maintaining state I use PostgreSQL. Driver: https://github.com/jackc/pgx (I use the pgxpools) Along with Sqlc for generating database models and allowing me to focus on just building queries in DBeaver. https://sqlc.dev/
-
Zig now has built-in HTTP server and client in std
Except pgx recommends using their native interface, not database/sql, for performance and extra features [0], so it's not that simple in practice.
[0]: https://github.com/jackc/pgx#choosing-between-the-pgx-and-da...
-
Go Roadmap
pgx is “PostgreSQL driver and toolkit for Go”. Take a look at https://github.com/jackc/pgx
-
sql.DB connection TTLs + aws rds postgresql
the postgres pgx driver supports this usecase: https://github.com/jackc/pgx/issues/676
-
Tools besides Go for a newbie
IDE: use whatever make you productive. I personally use vscode. VCS: git, as golang communities use github heavily as base for many libraries. AFAIK Linter: use staticcheck for linting as it looks like mostly used linting tool in go, supported by many also. In Vscode it will be recommended once you install go plugin. Libraries/Framework: actually the standard libraries already included many things you need, decent enough for your day-to-day development cycles(e.g. `net/http`). But here are things for extra: - Struct fields validator: validator - Http server lib: chi router , httprouter , fasthttp (for non standard http implementations, but fast) - Web Framework: echo , gin , fiber , beego , etc - Http client lib: most already covered by stdlib(net/http), so you rarely need extra lib for this, but if you really need some are: resty - CLI: cobra - Config: godotenv , viper - DB Drivers: sqlx , postgre , sqlite , mysql - nosql: redis , mongodb , elasticsearch - ORM: gorm , entgo , sqlc(codegen) - JS Transpiler: gopherjs - GUI: fyne - grpc: grpc - logging: zerolog - test: testify , gomock , dockertest - and many others you can find here
What are some alternatives?
sqlx - general purpose extensions to golang's database/sql
GORM - The fantastic ORM library for Golang, aims to be developer friendly
pq - Pure Go Postgres driver for database/sql
gomock - GoMock is a mocking framework for the Go programming language.
go-sql-driver/mysql - Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package
sqlc - Generate type-safe code from SQL
migrate - Database migrations. CLI and Golang library.
goqu - SQL builder and query library for golang
bun - Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
go-sqlite3 - sqlite3 driver for go using database/sql
Gin - Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.
retry-go - Simple golang library for retry mechanism