SQL to Struct
Convert SQL CREATE TABLE statements to struct definitions
Overview
Quickly convert SQL CREATE TABLE statements into Go, TypeScript, or Rust struct code. The tool automatically detects field types, primary key constraints, and comments, generating ready-to-use type definitions so you can skip the manual work.
Features
- SQL CREATE TABLE parsing
- Convert to Go struct
- Convert to TypeScript interface
- Convert to Rust struct
- MySQL/PostgreSQL/SQLite type support
- Auto-convert field comments to annotations
- Custom naming convention support
How It Works
- Paste a complete CREATE TABLE SQL statement
- Select the target programming language and tag format
- Optionally configure naming style (camelCase/snake_case)
- The tool parses the SQL and generates matching struct code
- Copy the generated code into your project
Tips
- Ensure the SQL syntax is correct — missing keywords will cause parsing errors
- Export the full CREATE TABLE statement from your database before pasting
- Choose camelCase naming for Go/TypeScript code convention compliance
FAQ
Which database types are supported for mapping?
MySQL, PostgreSQL, and SQLite common data types are supported, automatically mapped to the corresponding language base types.
Are field comments preserved?
Yes, COMMENT content from SQL is extracted and converted to code comments in the target language for easier maintenance.
Can I process multiple tables at once?
Currently one table per conversion. For batch processing, paste and convert each table separately.