summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-08-22 21:20:20 -0600
committerSteve Manuel <nilslice@gmail.com>2017-08-22 21:20:20 -0600
commite9f9205b7199d7edffd53d9a45b38b57ccdc0ae1 (patch)
treefe55dee2c034408480394fac9b5464fdf6114165
parentcbb9f90f582e31a8375eec915525e2b4297d0e1a (diff)
adding String method to generated content type with better default for easier feature discovery
-rw-r--r--cmd/ponzu/templates/gen-content.tmpl6
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