modelfeed

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromPBInternalID

func FromPBInternalID(id *librarian.InternalID) int64

func FromPBTime

func FromPBTime(t *timestamppb.Timestamp) *time.Time

func ToPBTime

func ToPBTime(t *time.Time) *timestamppb.Timestamp

Types

type Converter

type Converter interface {
	// goverter:matchIgnoreCase
	// goverter:mapIdentity Id
	ToPBFeed(*Feed) *librarian.Feed
	// goverter:map InternalID Id
	ToPBFeedInternalID(Feed) librarian.InternalID
	// goverter:matchIgnoreCase
	// goverter:ignore Id
	// goverter:map UpdatedParsed | ToPBTime
	// goverter:map PublishedParsed | ToPBTime
	ToPBFeedItem(*Item) *librarian.FeedItem
	// goverter:matchIgnoreCase
	ToPBFeedImage(*Image) *librarian.FeedImage
	// goverter:matchIgnoreCase
	ToPBFeedEnclosure(*Enclosure) *librarian.FeedEnclosure

	// goverter:matchIgnoreCase
	// goverter:map Id InternalID
	// goverter:ignore FeedType
	// goverter:ignore FeedVersion
	FromPBFeed(*librarian.Feed) *Feed
	// goverter:matchIgnoreCase
	// goverter:map Id InternalID
	// goverter:map UpdatedParsed | FromPBTime
	// goverter:map PublishedParsed | FromPBTime
	FromPBFeedItem(*librarian.FeedItem) *Item
	// goverter:matchIgnoreCase
	FromPBFeedImage(*librarian.FeedImage) *Image
	// goverter:matchIgnoreCase
	FromPBFeedEnclosure(*librarian.FeedEnclosure) *Enclosure
}

goverter:converter goverter:extend FromPBInternalID

func NewConverter

func NewConverter() Converter

type ConverterImpl

type ConverterImpl struct{}

func (*ConverterImpl) FromPBFeed

func (c *ConverterImpl) FromPBFeed(source *v1.Feed) *Feed

func (*ConverterImpl) FromPBFeedEnclosure

func (c *ConverterImpl) FromPBFeedEnclosure(source *v1.FeedEnclosure) *Enclosure

func (*ConverterImpl) FromPBFeedImage

func (c *ConverterImpl) FromPBFeedImage(source *v1.FeedImage) *Image

func (*ConverterImpl) FromPBFeedItem

func (c *ConverterImpl) FromPBFeedItem(source *v1.FeedItem) *Item

func (*ConverterImpl) ToPBFeed

func (c *ConverterImpl) ToPBFeed(source *Feed) *v1.Feed

func (*ConverterImpl) ToPBFeedEnclosure

func (c *ConverterImpl) ToPBFeedEnclosure(source *Enclosure) *v1.FeedEnclosure

func (*ConverterImpl) ToPBFeedImage

func (c *ConverterImpl) ToPBFeedImage(source *Image) *v1.FeedImage

func (*ConverterImpl) ToPBFeedInternalID

func (c *ConverterImpl) ToPBFeedInternalID(source Feed) v1.InternalID

func (*ConverterImpl) ToPBFeedItem

func (c *ConverterImpl) ToPBFeedItem(source *Item) *v1.FeedItem

type Enclosure

type Enclosure struct {
	URL    string `json:"url,omitempty"`
	Length string `json:"length,omitempty"`
	Type   string `json:"type,omitempty"`
}

Enclosure is a file associated with a given Item.

type Feed

type Feed struct {
	InternalID  int64     `json:"internal_id,omitempty"`
	Title       string    `json:"title,omitempty"`
	Description string    `json:"description,omitempty"`
	Link        string    `json:"link,omitempty"`
	Authors     []*Person `json:"authors,omitempty"`
	Language    string    `json:"language,omitempty"`
	Image       *Image    `json:"image,omitempty"`
	Items       []*Item   `json:"items"`
	FeedType    string    `json:"feedType"`
	FeedVersion string    `json:"feedVersion"`
}

func (Feed) Len

func (f Feed) Len() int

Len returns the length of Items.

func (Feed) Less

func (f Feed) Less(i, k int) bool

Less compares PublishedParsed of Items[i], Items[k] and returns true if Items[i] is less than Items[k].

func (Feed) Swap

func (f Feed) Swap(i, k int)

Swap swaps Items[i] and Items[k].

type Image

type Image struct {
	URL   string `json:"url,omitempty"`
	Title string `json:"title,omitempty"`
}

Image is an image that is the artwork for a given feed or item.

type Item

type Item struct {
	InternalID      int64        `json:"internal_id,omitempty"`
	Title           string       `json:"title,omitempty"`
	Description     string       `json:"description,omitempty"`
	Content         string       `json:"content,omitempty"`
	Link            string       `json:"link,omitempty"`
	Updated         string       `json:"updated,omitempty"`
	UpdatedParsed   *time.Time   `json:"updatedParsed,omitempty"`
	Published       string       `json:"published,omitempty"`
	PublishedParsed *time.Time   `json:"publishedParsed,omitempty"`
	Authors         []*Person    `json:"authors,omitempty"`
	GUID            string       `json:"guid,omitempty"`
	Image           *Image       `json:"image,omitempty"`
	Enclosures      []*Enclosure `json:"enclosures,omitempty"`
}

type Person

type Person struct {
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

Person is an individual specified in a feed (e.g. an author).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL