G
GoTool

MySQL → Go Struct

Convert MySQL CREATE TABLE to Go struct

Input0
Output
0

About MySQL to Go Struct

Convert MySQL CREATE TABLE DDL statements to Go struct definitions with proper type mapping and json/db tags. Automatically infers struct names from table names and maps MySQL column types to appropriate Go types.

Frequently Asked Questions

What MySQL types are supported?

All common types: INT, BIGINT, VARCHAR, TEXT, DATETIME, TIMESTAMP, DECIMAL, FLOAT, DOUBLE, BOOLEAN, BLOB, JSON, and more.

Does it generate GORM tags?

Yes, it generates both json and db tags by default. You can use the Go Struct Tag tool for more customization options.

How are nullable columns handled?

Nullable columns use pointer types (e.g., *string, *int64) or sql.Null* types to properly represent NULL values in Go.