Files
PandaX/resource/template/go/model.template
2021-12-31 17:35:43 +08:00

27 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ==========================================================================
// GFast自动生成model代码无需手动修改重新生成会自动覆盖.
// 生成日期:{{.table.CreateTime}}
// 生成路径: {{.table.PackageName}}/model/{{.table.TableName}}.go
// 生成人:{{.table.FunctionAuthor}}
// ==========================================================================
////
package model
{{$hasGTime:=false}}
{{range $index, $column := .table.Columns}}
{{if eq $column.GoType "Time"}}
{{$hasGTime = true}}
{{end}}
{{end}}
{{if $hasGTime}}
import "github.com/gogf/gf/os/gtime"
{{end}}
// {{.table.ClassName}} is the golang structure for table {{.table.TableName}}.
type {{.table.ClassName}} struct {
{{range $index, $column := .table.Columns}}
{{if eq $column.IsPk "1"}} {{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `orm:"{{$column.ColumnName}},primary" json:"{{$column.HtmlField}}"` // {{$column.ColumnComment}} {{else}} {{$column.GoField}} {{if eq $column.GoType "Time"}}*gtime.Time{{else}}{{$column.GoType}}{{end}} `orm:"{{$column.ColumnName}}" json:"{{$column.HtmlField}}"` // {{$column.ColumnComment}} {{end}}
{{end}}
}