Top 23 Go SQL Projects
TiDB is an open source distributed HTAP database compatible with the MySQL protocolProject mention: Question regarding computing industry | reddit.com/r/NTU | 2021-06-20
My knowledge is still quite limited because I never worked on the internals of distributed databases (I've only used and deployed them as an intern) but I have taken Advanced Databases CZ4031 in NTU and Parallel and Distributed Algorithms CS4231 in NUS which helped me get some basic understanding so you can consider taking those if you are interested. If you want to see how an open source database looks like, I would recommend TiDB because their documentation is quite good.
CockroachDB - the open source, cloud-native distributed SQL database.Project mention: CockroachDB Grants and Schemas explained | dev.to | 2021-08-28
And here: https://github.com/cockroachdb/cockroach/issues/16790
Run Linux Software Faster and Safer than Linux with Unikernels.
Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package (by go-sql-driver)Project mention: Do you use connection attributes and assign a name to your clients when connecting to MySQL? | reddit.com/r/mysql | 2021-08-13
Missing support: - Go go-sql-driver/mysql - PHP
Dolt – It's Git for DataProject mention: Dolt Is Git for Data | news.ycombinator.com | 2021-09-27
The lightweight, distributed relational database built on SQLiteProject mention: What is the best approach in order to send the database state to a server periodically? | reddit.com/r/learnprogramming | 2021-09-17
Disclaimer: I have never tried this, but a quick search found this: https://github.com/rqlite/rqlite
Database migrations. CLI and Golang library.Project mention: Strings, arrays, recursion, and parsing JSON: Exploring PL/pgSQL | news.ycombinator.com | 2021-10-25
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.
Universal command-line interface for SQL databasesProject mention: usql v0.9.4 | reddit.com/r/golang | 2021-08-29
Scout APM: A developer's best friend. Try free for 14-days. Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.
Golang ORM with focus on PostgreSQL features and performanceProject mention: Go for Backend development | reddit.com/r/golang | 2021-09-06
Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean ArchitectureProject mention: Any suggestions for a beginner to build a microservice using Go with ES? | reddit.com/r/elasticsearch | 2021-08-11
Has anyone come across any Golang repo like go-clean-arch which uses elasticsearch? As I am a beginner and wanted to have a bit of practice of building microservice using Go with Elasticsearch.
Generate type safe Go from SQLProject mention: Compile SQL to type-safe Go | reddit.com/r/AgnosTechValley | 2021-09-30
Sql mock driver for golang to test database interactionsProject mention: Go Package for better integration tests: github.com/ory/dockertest | dev.to | 2021-04-23
We have different ways to write our tests depending on what datastore we are using, for example if we are testing database calls that happen to be using database/sql then importing a package like github.com/DATA-DOG/go-sqlmock could work.
Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server (by xo)Project mention: We Went All in on Sqlc/Pgx for Postgres and Go | news.ycombinator.com | 2021-09-08
I'm a big fan of the database first code generator approach to talking to an SQL database, so much so that I wrote pggen (not to be confused with pggen, as far as I can tell a sqlc fork, which I just recently learned about).
I'm a really big partisan of this approach, but I think I'd like to play the devil's advocate here and lay out some of the weaknesses of both a database first approach in general and sqlc in particular.
All database first approaches struggle with SQL metaprogramming when compared with a query builder library or an ORM. For the most part, this isn't an issue. Just writing SQL and using parameters correctly can get you very far, but there are a few times when you really need it. In particular, faceted search and pagination are both most naturally expressed via runtime metaprogramming of the SQL queries that you want to execute.
Another drawback is poor support from the database for this kind of approach. I only really know how postgres does here, and I'm not sure how well other databases expose their queries. When writing one of these tools you have to resort to tricks like creating temporary views in order infer the argument and return types of a query. This is mostly opaque to the user, but results in weird stuff bubbling up to the API like the tool not being able to infer nullability of arguments and return values well and not being able to support stuff like RETURNING in statements. sqlc is pretty brilliant because it works around this by reimplementing the whole parser and type checker for postgres in go, which is awesome, but also a lot of work to maintain and potentially subtlety wrong.
A minor drawback is that you have to retrain your users to write `x = ANY($1)` instead of `x IN ?`. Most ORMs and query builders seem to lean on their metaprogramming abilities to auto-convert array arguments in the host language into tuples. This is terrible and makes it really annoying when you want to actually pass an array into a query with an ORM/query builder, but it's the convention that everyone is used to.
There are some other issues that most of these tools seem to get wrong, but are not impossible in principle to deal with for a database first code generator. The biggest one is correct handling of migrations. Most of these tools, sqlc included, spit out the straight line "obvious" go code that most people would write to scan some data out of a db. They make a struct, then pass each of the field into Scan by reference to get filled in. This works great until you have a query like `SELECT * FROM foos WHERE field = $1` and then run `ALTER TABLE foos ADD COLUMN new_field text`. Now the deployed server is broken and you need to redeploy really fast as soon as you've run migrations. opendoor/pggen handles this, but I'm not aware of other database first code generators that do (though I could definitely have missed one).
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.Project mention: Migrating from PHP to Go | reddit.com/r/golang | 2021-09-30
upper.io is a viable alternative to GORM. Just a suggestion.
Query git repositories with SQL. Generate reports, perform status checks, analyze codebases. 🔍 📊Project mention: Semantic Git Commit Messages | news.ycombinator.com | 2021-09-27
Assuming committers adhere to it, there could be some interesting use cases when combined with a tool like AskGit (https://github.com/askgitdev/askgit) for understanding what "categories" of work is being done in a codebase.
Maybe even what directories/files tend to see `fix` or `refactor` more frequently (signs of a poorly design or "hot" area?)
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.Project mention: Show HN: Work with CSV files using SQL. For data scientists and engineers | news.ycombinator.com | 2021-07-18
SQL schema migration tool for Go.Project mention: What is the fastest way to clear my SQL database between integration tests? | reddit.com/r/golang | 2021-01-29
Keep your migrations in the code repo and use a tool like sql-migrate to automatically apply them for you. At my job, we run a new container for each package's tests, and create a new db with the migration scripts for every test. It's certainly a bit slower, but the reproducibility is worth it.
A database migration tool. Supports SQL migrations and Go functions.Project mention: Adding support for out-of-order migrations in pressly/goose | reddit.com/r/golang | 2021-10-25
For a long time folks have been requesting the ability to apply out-of-order migrations. Happy to say we added this functionality to pressly/goose.
cloudquery transforms your cloud infrastructure into SQL database for easy monitoring, governance and security.Project mention: I built an open-source GraphQL powered search engine for your AWS infrastructure. | reddit.com/r/aws | 2021-10-02
SQL version - https://github.com/cloudquery/cloudquery
GraphJin - Build APIs in 5 minutes with GraphQL. An instant GraphQL to SQL compiler.Project mention: Secure Key Management in GraphJin the instant GraphQL to SQL service | reddit.com/r/golang | 2021-10-12
xorm是一个简单而强大的Go语言ORM库，通过它可以使数据库操作非常简便。本库是基于原版xorm的定制增强版本，为xorm提供类似ibatis的配置文件及动态SQL支持，支持AcitveRecord操作 (by xormplus)
SQL builder and query library for golangProject mention: Migrating from PHP to Go | reddit.com/r/golang | 2021-09-30
https://github.com/doug-martin/goqu for building SQL queries. Supports MySQL and Postgres at least - super handy!
reasonable handling of nullable values (by guregu)Project mention: Gonion - Golang Client for querying Tor network data | reddit.com/r/golang | 2021-09-29
Unfortunately in Go, switching to *bool makes the api a little more awkward to use since users that need to set true or false have to define a local variable then use a pointer to that. Another option would be something like null, but that adds a dependency to your currently-dependency-free project. If anyone has a better solution to this pattern, I'd love to hear it.
A decentralized, trusted, high performance, SQL database with blockchain features
What are some of the best open-source SQL projects in Go? This list will help you:
Are you hiring? Post a new remote job listing for free.