Skip to content

peterSZW/gormsqlbuilder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GormSQLBuilder

type PersonDemo struct {
	Id          string    `json:"id" gorm:"column:id;primary_key"`                         
	User_id     string    `json:"guser_id" gorm:"column:guser_id"  gensql:"notnull"`     
	Age         int       `json:"age" gorm:"column:age"  gensql:"notnull"` 
	Weight      float32   `json:"weight" gorm:"column:weight"  gensql:"notnull"` 
	Create_time time.Time `json:"create_time" gorm:"column:create_time" gensql:"notnull"` 
}

1.Add tags on structure

gensql:"notnull"

2.Call CreateSQL to get the insert sql


import "github.com/peterSZW/gormsqlbuilder"

var person PersonDemo
sql,err:=gormsqlbuilder.CreateSQL(person)
fmt.Println(sql)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages