togo

module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: Apache-2.0

README

dmltogo

Generate go struct by create sql DML.

Doc

Example:
dmltogo.DmlToGo(`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 dmltogo A util can help to generate go struct by Create SQL DML.
Package dmltogo A util can help to generate go struct by Create SQL DML.
Package util
Package util

Jump to

Keyboard shortcuts

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