github.com/unionj-cloud/go-doudou/v2@v2.3.5/toolkit/gormgen/internal/template/dto.go (about)

     1  package template
     2  
     3  // Dto used as a variable because it cannot load template file after packed, params still can pass file
     4  const Dto = EditMark + `
     5  package dto
     6  
     7  import (
     8  	"encoding/json"
     9  	"time"
    10  
    11  	"gorm.io/datatypes"
    12  	"gorm.io/gorm"
    13  	"gorm.io/gorm/schema"
    14  	{{range .ImportPkgPaths}}{{.}} ` + "\n" + `{{end}}
    15  )
    16  
    17  // {{.ModelStructName}} {{.StructComment}}
    18  type {{.ModelStructName}} struct {
    19      {{range .Fields}}
    20      {{if .MultilineComment -}}
    21  	/*
    22  {{.ColumnComment}}
    23      */
    24  	{{end -}}
    25      {{.Name}} {{.Type | convert}} ` + "`{{.Tags}}` " +
    26  	"{{if not .MultilineComment}}{{if .ColumnComment}}// {{.ColumnComment}}{{end}}{{end}}" +
    27  	`{{end}}
    28  }
    29  
    30  `