Open-source Go projects categorized as MySQL | Edit details

Top 23 Go MySQL Projects

  • GitHub repo tidb

    TiDB is an open source distributed HTAP database compatible with the MySQL protocol

    Project mention: Comparing Nginx Performance in Bare Metal and Virtual Environments | news.ycombinator.com | 2021-10-29

    I do agree with you in that regard, however, that's also a dangerous line of thinking.

    There are attempts to provide horizontal scalability for RDBMSes in a transparent way, like TiDB https://pingcap.com/ (which is compatible with the MySQL 5.7 drivers), however, the list of functionality that's sacrificed to achieve easily extensible clusters is a long one: https://docs.pingcap.com/tidb/stable/mysql-compatibility

    There are other technologies, like MongoDB, which sometimes are more successful at a clustered configuration, however most of the traditional RDBMSes work best in a leader-follower type of replication scenario, because even those aforementioned systems oftentimes have data consistency issues that may eventually pop up.

    Essentially, my argument is that the lack of good horizontally scalable databases or other data storage solutions is easily explainable by the fact that the problem itself isn't solvable in any easy way, apart from adopting eventual consistency, which is probably going to create more problems than it will solve in case of any pre-existing code that makes assumptions about what ways it'll be able to access data and operate on it: https://en.wikipedia.org/wiki/Fallacies_of_distributed_compu...

    To that end, i'd perhaps like to suggest an alternative: use a single vertically scalable RDBMS instance when possible, with a hot standby if you have the resources for that. Let the architecture around it be horizontally scalable instead, and let it deal with the complexities of balancing the load and dealing with backpressure - introduce a message queue if you must, maybe even an in-memory one for simplicity's sake, or consider an event based architecture where "what needs to be done" is encapsulated within a data structure that can be passed around and applied whenever possible. In my eyes, such solutions can in many cases be better than losing the many benefits of having a single source of truth.

    Alternatively, consider sharding as a possibility, or, alternatively, do some domain driven design, figure out where to draw some boundaries and split your service into multiple ones that cover the domain with which you need to work with. Then you have one DB for sales, one for account management, one for reports and so on, all separated by something as simple as REST interfaces and with rate limits or any of the other mechanisms.

    If, however, neither of those two groups of approaches don't seem to be suitable for the loads that you're dealing with, then you probably have a team of very smart people and a large amount of resources to figure out what will work best.

    To sum up, if there are no good solutions in the space, perhaps that's because the problems themselves haven't been solved yet. Thus, sooner or later, they'll need to be sidestepped and their impact mitigated in whatever capacity is possible.

  • GitHub repo vitess

    Vitess is a database clustering system for horizontal scaling of MySQL.

    Project mention: Databases in 2021: A Year in Review | news.ycombinator.com | 2021-12-29

    I am so confused. https://vitess.io/ I would check this page out and view it's "Who uses Vitess" section. Postgres is awesome if you are running a stand alone server with 300 users. But at scale mysql has all the solutions.

  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.

  • GitHub repo go-sql-driver/mysql

    Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package (by go-sql-driver)

    Project mention: Connecting to mysql returns Acces denied. Can only connect to the DB through dbeaver using a specific driver properties configuration. | reddit.com/r/golang | 2021-12-15

    I am using this driver https://github.com/go-sql-driver/mysql

  • GitHub repo dolt

    Dolt – It's Git for Data

    Project mention: How to manage a dataset that can be updated by multiple parties | reddit.com/r/datasets | 2022-01-12
  • GitHub repo gh-ost

    GitHub's Online Schema Migrations for MySQL

    Project mention: In MySQL, use utf8mb4 when you mean to work with utf8 in your programming language. | reddit.com/r/programming | 2022-01-13

    We use github’s ghost tool for the same reason. Relatively happy with it, but would appreciate your thoughts if you’ve used both.

  • GitHub repo migrate

    Database migrations. CLI and Golang library.

    Project mention: Clean Architecture based sample in Golang | reddit.com/r/golang | 2022-01-10

    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

  • GitHub repo usql

    Universal command-line interface for SQL databases

    Project mention: usql v0.9.4 | reddit.com/r/golang | 2021-08-29
  • SonarLint

    Deliver Cleaner and Safer Code - Right in Your IDE of Choice!. SonarLint is a free and open source IDE extension that identifies and catches bugs and vulnerabilities as you code, directly in the IDE. Install from your favorite IDE marketplace today.

  • GitHub repo kingshard

    A high-performance MySQL proxy

  • GitHub repo go-clean-arch

    Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean Architecture

    Project 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.

  • GitHub repo sqlc

    Generate type-safe code from SQL

    Project mention: Is it a good practice to make a wrapper around database? | reddit.com/r/golang | 2022-01-13

    Maybe take a look at sqlc (https://sqlc.dev). It nicely wraps/abstracts the database interaction with a database package. Makes it really easy to write "type safe" sql code without the problems you might run into when using object relational mappers.

  • GitHub repo SQLBoiler

    Generate a Go ORM tailored to your database schema.

    Project mention: Sql generator but for SQLite | reddit.com/r/golang | 2021-12-26

    Try sqlboiler. https://github.com/volatiletech/sqlboiler

  • GitHub repo orchestrator

    MySQL replication topology management and HA

    Project mention: MariaDB Cluster Management | reddit.com/r/mariadb | 2021-08-24

    https://github.com/openark/orchestrator might be something for you. I dont know if it works with Mariadb, but it is made for regular old MySQL.

  • GitHub repo space-cloud

    Open source Firebase + Heroku to develop, scale and secure serverless apps on Kubernetes

    Project mention: Firebase Alternative for iOS | reddit.com/r/iOSProgramming | 2021-09-04
  • GitHub repo xo

    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[1] (not to be confused with pggen[2], 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).

    Also the article is missing a few more tools in this space. https://github.com/xo/xo. https://github.com/gnormal/gnorm.

    [1]: https://github.com/opendoor/pggen

  • GitHub repo upper.io/db

    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.

  • GitHub repo octosql

    OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.

    Project mention: Tricking PostgreSQL into using an insane – but 200x faster – query plan | news.ycombinator.com | 2022-01-18

    > [0]:https://github.com/cube2222/octosql

    nice tool, thanks for making this available.

  • GitHub repo dbmate

    :rocket: A lightweight, framework-agnostic database migration tool.

    Project mention: Why Google Treats SQL Like Code and You Should Too | news.ycombinator.com | 2022-01-13

    Yep, something like Flyway or Liquibase in the Java world has always made a lot of sense, though you also should be able to explicitly say when you do/don't want to run said migrations (e.g. run different profiles).

    Of course, recently i've also found Dbmate (https://github.com/amacneil/dbmate) which is a lightweight and language-agnostic tool that supports a variety of DBMSes (PostgreSQL, MySQL/MariaDB, SQLite and more recently even ClickHouse) and can be used for running SQL migration scripts regardless of what technologies that particular app uses (Java, .NET, Node, PHP and so on).

    Now, setting up the CI might be a little bit more difficult, but having one tool across all of the services in your architecture can be worth it!

  • GitHub repo goose

    A database migration tool. Supports SQL migrations and Go functions.

    Project mention: Golang for backend | reddit.com/r/golang | 2021-12-01

    https://github.com/pressly/goose. This migration tool is close to alembic.

  • GitHub repo bytebase

    Web-based, zero-config, dependency-free database schema change and version control tool for teams. Public demo: https://demo.bytebase.com

    Project mention: Database versioning | reddit.com/r/SQL | 2022-01-14

    I am the creator of bytebase.com, a web-based database schema change and version control tool. It records schema version internally and also allows user to integrate VCS (GitLab CE/EE for now) via couple clicks.

  • GitHub repo algernon

    :tophat: Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support

  • GitHub repo graphjin

    GraphJin - Build APIs in 5 minutes with GraphQL. An instant GraphQL to SQL compiler.

    Project mention: Chosing between Golang and Rust for a new project | reddit.com/r/graphql | 2021-12-17

    The GraphQL => SQL compiler provided by dosco/graphjin solves a lot of problems for my use case.

  • GitHub repo gormt

    database to golang struct

  • GitHub repo xorm

    xorm是一个简单而强大的Go语言ORM库,通过它可以使数据库操作非常简便。本库是基于原版xorm的定制增强版本,为xorm提供类似ibatis的配置文件及动态SQL支持,支持AcitveRecord操作 (by xormplus)

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2022-01-18.

Go MySQL related posts


What are some of the best open-source MySQL projects in Go? This list will help you:

Project Stars
1 tidb 30,193
2 vitess 13,200
3 go-sql-driver/mysql 11,820
4 dolt 10,024
5 gh-ost 9,583
6 migrate 7,884
7 usql 6,900
8 kingshard 5,919
9 go-clean-arch 5,091
10 sqlc 4,658
11 SQLBoiler 4,567
12 orchestrator 4,372
13 space-cloud 3,350
14 xo 2,989
15 upper.io/db 2,872
16 octosql 2,645
17 dbmate 2,282
18 goose 2,172
19 bytebase 2,065
20 algernon 1,897
21 graphjin 1,705
22 gormt 1,660
23 xorm 1,484
Find remote MySQL jobs at our new job board 99remotejobs.com. There are 2 new remote jobs listed recently.
Are you hiring? Post a new remote job listing for free.
OPS - Build and Run Open Source Unikernels
Quickly and easily build and deploy open source unikernels in tens of seconds. Deploy in any language to any cloud.