diff options
author | Steve Manuel <nilslice@gmail.com> | 2017-08-22 21:40:19 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-22 21:40:19 -0600 |
commit | 69f1bb86908c17303277051491f1f160909b9896 (patch) | |
tree | fe55dee2c034408480394fac9b5464fdf6114165 | |
parent | 1d8c67d63c4c177c048bb18227804b9c942f0230 (diff) | |
parent | e9f9205b7199d7edffd53d9a45b38b57ccdc0ae1 (diff) |
Merge pull request #188 from ponzu-cms/ponzu-dev
[core] adding String method to generated content type with better default
-rw-r--r-- | cmd/ponzu/templates/gen-content.tmpl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/ponzu/templates/gen-content.tmpl b/cmd/ponzu/templates/gen-content.tmpl index 78b5123..9cfca9d 100644 --- a/cmd/ponzu/templates/gen-content.tmpl +++ b/cmd/ponzu/templates/gen-content.tmpl @@ -38,4 +38,10 @@ func ({{ .Initial }} *{{ .Name }}) MarshalEditor() ([]byte, error) { func init() { item.Types["{{ .Name }}"] = func() interface{} { return new({{ .Name }}) } +} + +// String defines how a {{ .Name }} is printed. Update it using more descriptive +// fields from the {{ .Name }} struct type +func ({{ .Initial }} *{{ .Name }}) String() string { + return fmt.Sprintf("{{ .Name }}: %s", {{ .Initial }}.UUID) }
\ No newline at end of file |