Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByLastModified ¶
type ByLastModified []model.InternalNotification
ByLastModified sorts InternalNotifications by last modified date.
func (ByLastModified) Len ¶
func (s ByLastModified) Len() int
func (ByLastModified) Less ¶
func (s ByLastModified) Less(i, j int) bool
func (ByLastModified) Swap ¶
func (s ByLastModified) Swap(i, j int)
type DefaultMapper ¶
type DefaultMapper struct {
ApiHost string
}
DefaultMapper is the standard NotificationsMapper implementation
func (DefaultMapper) MapInternalNotificationToPublic ¶
func (m DefaultMapper) MapInternalNotificationToPublic(notification model.InternalNotification) model.PublicNotification
MapInternalNotificationToPublic maps an InternalNotification to a PublicNotification
func (DefaultMapper) MapRequestToInternalNotification ¶
func (m DefaultMapper) MapRequestToInternalNotification(uuid string, decoder *json.Decoder) (*model.InternalNotification, error)
MapRequestToInternalNotification maps json (from a decoder) to an InternalNotification
type NextLinkGenerator ¶
type NextLinkGenerator interface { NextLink(since time.Time, offset int, notifications []model.InternalNotification) model.Link ProcessRequestLink(uri *url.URL) *url.URL }
NextLinkGenerator returns the link to the next result set in a paginated response.
type NotificationsMapper ¶
type NotificationsMapper interface { MapRequestToInternalNotification(uuid string, decoder *json.Decoder) (*model.InternalNotification, error) MapInternalNotificationToPublic(notification model.InternalNotification) model.PublicNotification }
NotificationsMapper maps notifications from json to internal and internal to public.
type OffsetNextLink ¶
OffsetNextLink is the default implementation for NextLinkGenerator
func (OffsetNextLink) NextLink ¶
func (o OffsetNextLink) NextLink(since time.Time, offset int, notifications []model.InternalNotification) model.Link
NextLink given the since date and offset from the original incoming request, and the notifications read from the db, return the 'next' link
func (OffsetNextLink) ProcessRequestLink ¶
func (o OffsetNextLink) ProcessRequestLink(uri *url.URL) *url.URL