model

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "zenfeed"
	Module  = "github.com/glidea/zenfeed"
)
View Source
const (
	LabelType    = "type"
	LabelSource  = "source"
	LabelTitle   = "title"
	LabelLink    = "link"
	LabelPubTime = "pub_time"
	LabelContent = "content"
)

LabelXXX is the metadata label for the feed.

View Source
const (
	LabelFilterEqual    = "="
	LabelFilterNotEqual = "!="
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Feed

type Feed struct {
	ID     uint64    `json:"-"`
	Labels Labels    `json:"labels"`
	Time   time.Time `json:"time"`
}

Feed is core data model for a feed.

E.g. {
 "labels": {
   "title": "The most awesome feed management software of 2025 has been born",
   "content": "....",
   "link": "....",
 },
 "time": "2025-01-01T00:00:00Z",
}

func (*Feed) Validate

func (f *Feed) Validate() error

type Label

type Label struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type LabelFilter added in v0.3.0

type LabelFilter struct {
	Label string
	Equal bool
	Value string
}

func NewLabelFilter added in v0.3.0

func NewLabelFilter(filter string) (LabelFilter, error)

func (LabelFilter) Match added in v0.3.0

func (f LabelFilter) Match(labels Labels) bool

type LabelFilters added in v0.3.0

type LabelFilters []LabelFilter

func NewLabelFilters added in v0.3.0

func NewLabelFilters(filters []string) (LabelFilters, error)

func (LabelFilters) Match added in v0.3.0

func (ls LabelFilters) Match(labels Labels) bool

type Labels

type Labels []Label

func (Labels) EnsureSorted

func (ls Labels) EnsureSorted()

func (*Labels) FromMap

func (ls *Labels) FromMap(m map[string]string)

func (Labels) Get

func (ls Labels) Get(key string) string

func (Labels) Map

func (ls Labels) Map() map[string]string

func (Labels) MarshalJSON

func (ls Labels) MarshalJSON() ([]byte, error)

func (*Labels) Put

func (ls *Labels) Put(key, value string, sort bool)

func (Labels) String

func (ls Labels) String() string

func (*Labels) UnmarshalJSON

func (ls *Labels) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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