togo

module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: Apache-2.0

README

ddltogo

Generate go struct by create sql DDL.

Doc

Example:
ddltogo.DdlToGo(`CREATE TABLE Persons (
                     PersonID int,
                     LastName varchar(255),
                     FirstName varchar(255),
                     Address varchar(255),
                     City varchar(255) 
                 );`)

Output:

package model

type Person struct {
	Address   string `gorm:"column:Address" json:"Address"`
	City      string `gorm:"column:City" json:"City"`
	FirstName string `gorm:"column:FirstName" json:"FirstName"`
	LastName  string `gorm:"column:LastName" json:"LastName"`
	PersonID  int    `gorm:"column:PersonID" json:"PersonID"`
}

// TableName sets the insert table name for this struct type
func (p *Person) TableName() string {
	return "Persons"
}

Directories

Path Synopsis
Package ddltogo A util can help to generate go struct by Create SQL DDL.
Package ddltogo A util can help to generate go struct by Create SQL DDL.
Package jsontothrift
Package jsontothrift

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL