model

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	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"`
	GUID            string                 `json:"guid,omitempty"`
	Meta            map[string]interface{} `json:"meta,omitempty"`
	Tags            []string               `json:"tags,omitempty"`
}

Article model structure.

func (*Article) Hash

func (a *Article) Hash() string

Hash computes article hash

func (*Article) IsValid

func (a *Article) IsValid(maxAge time.Time) error

IsValid test if the article can be pushed

func (*Article) Match

func (a *Article) Match(tags []string) bool

Match test if articles tags matches other tags

func (*Article) RefDate

func (a *Article) RefDate() *time.Time

RefDate get article reference date (published or updated date)

func (*Article) String

func (a *Article) String() string

type CacheItem

type CacheItem struct {
	Value string    `json:"value"`
	Date  time.Time `json:"date"`
}

CacheItem stored into the cache.

type Filter

type Filter interface {
	DoFilter(article *Article) error
	GetSpec() FilterSpec
}

Filter is the filter interface

type FilterPlugin

type FilterPlugin interface {
	// Build a filter
	Build(params url.Values, tags []string) (Filter, error)
}

FilterPlugin is the interface of an filter plugin

type FilterSpec

type FilterSpec struct {
	Name  string
	Desc  string
	Tags  []string
	Props map[string]interface{}
}

FilterSpec contains filter specifications

type OutputPlugin

type OutputPlugin interface {
	// Build an output plugin
	Build(params url.Values, tags []string) (OutputProvider, error)
}

OutputPlugin is the interface of an output plugin

type OutputProvider

type OutputProvider interface {
	Send(article *Article) error
	GetSpec() OutputSpec
}

OutputProvider is the output provider interface

type OutputSpec

type OutputSpec struct {
	Name  string
	Desc  string
	Tags  []string
	Props map[string]interface{}
}

OutputSpec contains output specifications

func (OutputSpec) Hash

func (spec OutputSpec) Hash() string

Hash computes spec hash

type PluginInfo

type PluginInfo struct {
	Name string
	Type PluginType
}

PluginInfo contains plugins informations

type PluginType

type PluginType int

PluginType is the plugin type qualifier

const (
	// OUTPUT_PLUGIN output plugin type
	OUTPUT_PLUGIN PluginType = iota
	// FILTER_PLUGIN filter plugin type
	FILTER_PLUGIN
)

Jump to

Keyboard shortcuts

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