Skip to content

Fix: remove hard dependency on gorm.io/driver/mysql#321

Open
dannyota wants to merge 1 commit intogo-gorm:masterfrom
dannyota:json-remove-mysql-hard-dep
Open

Fix: remove hard dependency on gorm.io/driver/mysql#321
dannyota wants to merge 1 commit intogo-gorm:masterfrom
dannyota:json-remove-mysql-hard-dep

Conversation

@dannyota
Copy link

@dannyota dannyota commented Feb 6, 2026

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Replace *mysql.Dialector type assertions with reflection-based isMariaDB() helper to read ServerVersion. Removes gorm.io/driver/mysql import from json.go, json_map.go, json_type.go.

Fixes #160

User Case Description

Consumers of gorm.io/datatypes transitively pull in gorm.io/driver/mysql even if they only use PostgreSQL or SQLite. After this change, all driver dependencies are test-only.

Replace direct *mysql.Dialector type assertions with a reflection-based
isMariaDB() helper to read the ServerVersion field. This removes the
compile-time dependency on gorm.io/driver/mysql from production code,
so library consumers no longer transitively pull in the MySQL driver.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dannyota dannyota changed the title json: remove hard dependency on gorm.io/driver/mysql Fix: remove hard dependency on gorm.io/driver/mysql Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclude Unused Imports

1 participant