other: 配置导出 Golang 结构体注释优化
This commit is contained in:
parent
130869af4e
commit
9349e3cdbe
|
@ -38,7 +38,7 @@ func (slf *Xlsx) GetDisplayName() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (slf *Xlsx) GetDescription() string {
|
func (slf *Xlsx) GetDescription() string {
|
||||||
return "暂无描述"
|
return slf.GetDisplayName()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (slf *Xlsx) GetIndexCount() int {
|
func (slf *Xlsx) GetIndexCount() int {
|
||||||
|
@ -57,10 +57,10 @@ func (slf *Xlsx) GetFields() []pce.DataField {
|
||||||
}
|
}
|
||||||
field = pce.DataField{
|
field = pce.DataField{
|
||||||
Index: index,
|
Index: index,
|
||||||
Name: strings.ReplaceAll(strings.ReplaceAll(str.FirstUpper(name.String()), "\r", ""), "\n", ""),
|
Name: strings.ReplaceAll(strings.ReplaceAll(str.FirstUpper(name.String()), "\r", " "), "\n", " "),
|
||||||
Type: fieldType.String(),
|
Type: fieldType.String(),
|
||||||
ExportType: exportType.String(),
|
ExportType: exportType.String(),
|
||||||
Desc: strings.ReplaceAll(strings.ReplaceAll(desc.String(), "\r", ""), "\n", ""),
|
Desc: strings.ReplaceAll(strings.ReplaceAll(desc.String(), "\r", " "), "\n", " "),
|
||||||
}
|
}
|
||||||
if len(field.Name) == 0 || len(field.Type) == 0 || len(field.ExportType) == 0 {
|
if len(field.Name) == 0 || len(field.Type) == 0 || len(field.ExportType) == 0 {
|
||||||
return field, false
|
return field, false
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
|
|
||||||
const (
|
const (
|
||||||
{{- range .Templates}}
|
{{- range .Templates}}
|
||||||
{{.Name}}Sign Sign = "{{.Name}}"
|
{{.Name}}Sign Sign = "{{.Name}}" // {{.Desc}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
var (
|
var (
|
||||||
{{- range .Templates}}
|
{{- range .Templates}}
|
||||||
{{- if $.HasIndex .}}
|
{{- if $.HasIndex .}}
|
||||||
{{.Name}} {{$.GetVariable .}}
|
{{.Name}} {{$.GetVariable .}} // {{.Desc}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
)
|
)
|
||||||
|
@ -60,7 +60,7 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
var (
|
var (
|
||||||
{{- range .Templates}}
|
{{- range .Templates}}
|
||||||
{{- if $.HasIndex .}}{{- else}}
|
{{- if $.HasIndex .}}{{- else}}
|
||||||
{{.Name}} *{{$.GetConfigName .}}
|
{{.Name}} *{{$.GetConfigName .}} // {{.Desc}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
)
|
)
|
||||||
|
@ -68,7 +68,7 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
var (
|
var (
|
||||||
{{- range .Templates}}
|
{{- range .Templates}}
|
||||||
{{- if $.HasIndex .}}
|
{{- if $.HasIndex .}}
|
||||||
_{{.Name}} {{$.GetVariable .}}
|
_{{.Name}} {{$.GetVariable .}} // {{.Desc}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
)
|
)
|
||||||
|
@ -76,12 +76,13 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
var (
|
var (
|
||||||
{{- range .Templates}}
|
{{- range .Templates}}
|
||||||
{{- if $.HasIndex .}}{{- else}}
|
{{- if $.HasIndex .}}{{- else}}
|
||||||
_{{.Name}} *{{$.GetConfigName .}}
|
_{{.Name}} *{{$.GetConfigName .}} // {{.Desc}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
{{- range .Templates}}
|
{{- range .Templates}}
|
||||||
|
// {{$.GetConfigName .}} {{.Desc}}
|
||||||
type {{$.GetConfigName .}} struct {
|
type {{$.GetConfigName .}} struct {
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .IsSlice}}
|
{{- if .IsSlice}}
|
||||||
|
@ -110,6 +111,7 @@ func (slf *Golang) Render(templates ...*pce.TmplStruct) (string, error) {
|
||||||
|
|
||||||
{{- range .Templates}}
|
{{- range .Templates}}
|
||||||
{{- range .AllChildren}}
|
{{- range .AllChildren}}
|
||||||
|
// {{.Name}} {{.Desc}}
|
||||||
type {{.Name}} struct {
|
type {{.Name}} struct {
|
||||||
{{- range .Fields}}
|
{{- range .Fields}}
|
||||||
{{- if .IsSlice}}
|
{{- if .IsSlice}}
|
||||||
|
|
Loading…
Reference in New Issue