diff options
Diffstat (limited to 'content/item.go')
-rw-r--r-- | content/item.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/content/item.go b/content/item.go index 9eb3c16..e6c8243 100644 --- a/content/item.go +++ b/content/item.go @@ -1,6 +1,7 @@ package content import ( + "fmt" "net/http" uuid "github.com/satori/go.uuid" @@ -22,6 +23,7 @@ type Identifiable interface { ItemID() int SetItemID(int) UniqueID() uuid.UUID + String() string } // Hookable provides our user with an easy way to intercept or add functionality @@ -83,6 +85,12 @@ func (i Item) UniqueID() uuid.UUID { return i.UUID } +// String formats an Item into a printable value +// partially implements the Identifiable interface +func (i Item) String() string { + return fmt.Sprintf("Item ID: %s", i.UniqueID()) +} + // BeforeSave is a no-op to ensure structs which embed Item implement Hookable func (i Item) BeforeSave(req *http.Request) error { return nil |