|5 days ago||5 days ago|
|MIT License||GNU General Public License v3.0 or later|
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.
Back to basics: Writing an application using Go and PostgreSQL with pgx
4 projects | dev.to | 19 Jan 2022
By reading this tutorial, you'll learn how to use PostgreSQL with the Go programming language using the pgx driver and toolkit in a very productive manner. Furthermore, with the provided source code, you'll be able to learn how to write efficient and sound unit and integration tests, ready to be run locally or on a Continuous Integration environment, such as GitHub Actions. Use the Table of Contents to skip to a specific part of this long post. Don't forget to check out the accompanying repository github.com/henvic/pgxtutorial.
The proper way to deal with unique constraints using std "database/sql"
1 project | reddit.com/r/golang | 2 Jan 2022
I'm using github.com/jackc/pgx/stdlib to connect on Postgres.
Shared db connection pool in lambdas - do you ever close the connection explicitly?
1 project | reddit.com/r/aws | 20 Dec 2021
Just doing some testing with Golang postgres library pgx's connection pools, and I figure I could set this up outside of the main() function to share the connection pool with concurrent lambda executions. One thing I can't figure out though is I don't think I can safely, and explicitly call a close() on the connection. Is this normal to just let the connection time out if the lambda is not being used? If the connection times out before the lambda shuts off, then how can I re-establish a globally available connection pool? I imagine this is a potential problem for any db that's not accessible over HTTP(s)?
Why does my go.sum list unreferenced packages?
1 project | reddit.com/r/golang | 9 Dec 2021
Someone correct me if I'm wrong here, but I believe Go 1.17 with "Pruned module graphs in go 1.17 modules" fixes this issue, but for pgx, it won't take effect until both your own and their go.mod only support go 1.17 or above.
Is there any Go library to backup and restore PostgreSQL?
1 project | reddit.com/r/golang | 29 Nov 2021
I don't think so, but you should look at https://github.com/jackc/pgx which have low level features maybe for replication ?
Which SQL driver to use with Postgres
7 projects | reddit.com/r/golang | 27 Nov 2021
Back to basics: Writing an application using Go and PostgreSQL
15 projects | news.ycombinator.com | 22 Nov 2021
The way it parses dates using Unix time causes issues when you compare the values returned due to Go setting the location property:
pgx doesn't seem to handle reconnects the same way lib/pg does, but I haven't tested this recently: https://github.com/jackc/pgx/issues/672
[Question] Suggested way to update a database row using gRPC/PostgreSQL (pgx) ?
3 projects | reddit.com/r/golang | 16 Nov 2021
String manipulation could lead to nasty SQL injections and really because you're using pgx there's no need to do that either, see the Conn.SendBatch method, it should allow you to achieve what you're trying to do: execute multiple queries in a transaction and still get their results. (test example)
How do the database drivers communicate with the database? Is it just through some type of protocol at a certain port?
3 projects | reddit.com/r/golang | 9 Nov 2021
Problem trying to insert data received from Colly web scraper lib into DB via pgx library
2 projects | reddit.com/r/golang | 31 Oct 2021
In the process of trying to get better with Go, I have been trying to create a program that will scrape a subreddit and then save some info into a Postgres table. In this case, I decided to use r/frugalmalefashion and save the title and flair of recent posts into the table. I am using Colly to scrape data, and pgx as the database driver.
Clean Architecture based sample in Golang
2 projects | reddit.com/r/golang | 10 Jan 2022
Makefile requires migrate - a migration tool: https://github.com/golang-migrate/migrate. I stated it in Makefile and in README, but it's probably not very obvious: Requirements: migrate Migration tool: https://github.com/golang-migrate/migrate
Go questions from an Express TS dev
3 projects | reddit.com/r/golang | 27 Dec 2021
Screw DSLs. Write migrations using plain SQL
6 projects | news.ycombinator.com | 14 Dec 2021
Oh! Krab! v0.4.2 Postgres tool released - looking for feedback
1 project | reddit.com/r/PostgreSQL | 8 Dec 2021
Comparison section to other tools like Flyway, migrate in golang land, etc.
Golang for backend
13 projects | reddit.com/r/golang | 1 Dec 2021
Are entity framework tools typically avoided with MySQL & Go and are there alternatives for migration script tooling that version control the entire schema like SSDT?
2 projects | reddit.com/r/golang | 16 Nov 2021
Not that I know of. Generally the approach taken is to have ordered migration scripts and a schema version, and then have code automatically apply the appropriate set of migrations in the right order, for example using golang-migrate.
Strings, arrays, recursion, and parsing JSON: Exploring PL/pgSQL
1 project | news.ycombinator.com | 25 Oct 2021
I use this https://github.com/golang-migrate/migrate in a deploy step to each environment with the upgrade / downgrade scripts committed to the repo alongside the code. The scripts can do pretty much anything you need to do in PG including defining and executing functions.
Problem with migrations (go-migrate)
1 project | reddit.com/r/golang | 29 Sep 2021
Setting up golang-migrate for windows
1 project | dev.to | 13 Sep 2021
curl -L https://github.com/golang-migrate/migrate/releases/download/$version/migrate.$platform-amd64.tar.gz | tar xvz
We Went All in on Sqlc/Pgx for Postgres and Go
31 projects | news.ycombinator.com | 8 Sep 2021
I've used https://github.com/xo/xo, extended it with some custom functions for templating, extended the templates themselves, and can now generate CRUD for anything in the database, functions for common select queries based on the indices that exist in the database, field filtering and scanning, updates for subsets of fields including some atomic operations, etc. The sky is the limit honestly. It has allowed me to start with something approximating a statically generated ORM and extend it with any features I want as time goes on. I also write .extra.go files along side the generated .xo.go files to extend the structs that are generated with custom logic and methods to convert data into response formats.
I like the approach of starting with the database schema and generating code to reflect that. I define my schema in sql files and handle database migrations using https://github.com/golang-migrate/migrate.
If you take this approach, you can mostly avoid exposing details about the SQL driver being used, and since the driver is mostly used by a few templates, swapping drivers doesn't take much effort.
What are some alternatives?
pq - Pure Go Postgres driver for database/sql
sqlx - general purpose extensions to golang's database/sql
GORM - The fantastic ORM library for Golang, aims to be developer friendly
go-sql-driver/mysql - Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package
gomock - GoMock is a mocking framework for the Go programming language.
gormigrate - Minimalistic database migration helper for Gorm ORM
goose - A database migration tool. Supports SQL migrations and Go functions.
goqu - SQL builder and query library for golang
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.
go-fixtures - Django style fixtures for Golang's excellent built-in database/sql library.