model

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaskSecret

func MaskSecret(secret string) string

MaskSecret mask secret string

Types

type Article

type Article struct {
	Title           string                 `json:"title,omitempty"`
	Text            string                 `json:"text,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
	GetDef() FilterDef
}

Filter is the filter interface

type FilterDef

type FilterDef struct {
	ID    int    `json:"id"`
	Alias string `json:"alias"`
	Spec
	Condition string      `json:"condition"`
	Props     FilterProps `json:"props:omitempty"`
	Enabled   bool        `json:"enabled"`
}

FilterDef contains filter definition

type FilterDefCollection

type FilterDefCollection []*FilterDef

FilterDefCollection is an array of filter definition

type FilterPlugin

type FilterPlugin interface {
	// Build a filter
	Build(def *FilterDef) (Filter, error)
	// Spec returns plugin specs
	Spec() Spec
}

FilterPlugin is the interface of an filter plugin

type FilterProps

type FilterProps map[string]interface{}

FilterProps constain properties of a filter

func (FilterProps) Get

func (p FilterProps) Get(key string) string

Get property string value

type OutputDef

type OutputDef struct {
	ID    int    `json:"id"`
	Alias string `json:"alias"`
	Spec
	Condition string      `json:"condition"`
	Props     OutputProps `json:"props:omitempty"`
	Enabled   bool        `json:"enabled"`
}

OutputDef contains output definition

func (OutputDef) Hash

func (spec OutputDef) Hash() string

Hash computes spec hash

type OutputDefCollection

type OutputDefCollection []*OutputDef

OutputDefCollection is an array of output definition

type OutputPlugin

type OutputPlugin interface {
	// Build an output plugin
	Build(def *OutputDef) (OutputProvider, error)
	// Spec returns plugin specs
	Spec() Spec
}

OutputPlugin is the interface of an output plugin

type OutputProps

type OutputProps map[string]interface{}

OutputProps contains properties of an output

func (OutputProps) Get

func (p OutputProps) Get(key string) string

Get property string value

type OutputProvider

type OutputProvider interface {
	Send(article *Article) error
	GetDef() OutputDef
}

OutputProvider is the output provider interface

type PluginSpec

type PluginSpec struct {
	Type PluginType
	Spec
}

PluginSpec contains plugins specifications

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
)

type PropSpec

type PropSpec struct {
	Desc    string
	Name    string
	Type    PropType
	Options map[string]string
}

PropSpec contains property specification

type PropType

type PropType int

PropType is a enum to specify a property type

const (
	// Email type
	Email PropType = iota
	// Number type
	Number
	// Password type
	Password
	// Text type
	Text
	// URL type
	URL
	// Select type
	Select
	// Textarea type
	Textarea
)

func (PropType) String

func (p PropType) String() string

type Spec

type Spec struct {
	Name      string     `json:"name"`
	Desc      string     `json:"-"`
	PropsSpec []PropSpec `json:"-"`
}

Spec describe specifications of a processor

Jump to

Keyboard shortcuts

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