Created
March 22, 2019 02:57
-
-
Save juntaki/d4033a49d8bb1095d8771612b338fdf3 to your computer and use it in GitHub Desktop.
gorm reverse template for gorp (Use with https://github.com/juntaki/cmd/commit/87d0c3528880e92bfaef10a61e93cc64682edb7c)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package {{.Models}} | |
{{$ilen := len .Imports}} | |
{{if gt $ilen 0}} | |
import ( | |
{{range .Imports}}"{{.}}"{{end}} | |
) | |
{{end}} | |
{{range .Tables}} | |
type {{Mapper .Name}} struct { | |
{{$table := .}} | |
{{range .ColumnsSeq}}{{$col := $table.GetColumn .}} {{Mapper $col.Name}} {{Type $col}} {{Tag $table $col}} /* {{$col.Comment}} */ | |
{{end}}} | |
{{end}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment