diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-10-18 11:21:52 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-10-18 11:21:52 -0700 |
commit | 6746d1952b40c14d093717cb6c58fb7382150534 (patch) | |
tree | 68e81dfe7dd7464442d6974a73ee9edba84389bd | |
parent | 30b47784c5889539a65cc292066a400aa19c35d0 (diff) |
adding Sortable interface, implementing it on Item
-rw-r--r-- | content/item.go | 5 | ||||
-rw-r--r-- | management/editor/editor.go | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/content/item.go b/content/item.go index 7b25b14..7bb25db 100644 --- a/content/item.go +++ b/content/item.go @@ -7,3 +7,8 @@ type Item struct { Timestamp int64 `json:"timestamp"` Updated int64 `json:"updated"` } + +// Time implements the Sortable interface +func (i Item) Time() int64 { + return i.Timestamp +} diff --git a/management/editor/editor.go b/management/editor/editor.go index dc6f181..9ad7690 100644 --- a/management/editor/editor.go +++ b/management/editor/editor.go @@ -16,6 +16,11 @@ type Editable interface { MarshalEditor() ([]byte, error) } +// Sortable ensures data is sortable by time +type Sortable interface { + Time() int64 +} + // Editor is a view containing fields to manage content type Editor struct { ViewBuf *bytes.Buffer |