From e9f9205b7199d7edffd53d9a45b38b57ccdc0ae1 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Tue, 22 Aug 2017 21:20:20 -0600 Subject: adding String method to generated content type with better default for easier feature discovery --- cmd/ponzu/templates/gen-content.tmpl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmd') 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 -- cgit v1.2.3