model

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disconnect

func Disconnect()

Disconnect disconnects from the database.

func InitDB

func InitDB()

InitDB init db object

func PublishItem

func PublishItem(source *Source, item *rss.Item, html string) string

PublishItem publish item to telegraph

Types

type Content

type Content struct {
	SourceID     uint
	HashID       string `gorm:"primary_key"`
	RawID        string
	RawLink      string
	Title        string
	Description  string `gorm:"-"` //ignore to db
	TelegraphURL string
	EditTime
}

Content fetcher content

func GenContentAndCheckByFeedItem

func GenContentAndCheckByFeedItem(s *Source, item *rss.Item) (*Content, bool, error)

GenContentAndCheckByFeedItem generate content by fetcher item

type EditTime

type EditTime struct {
	CreatedAt time.Time
	UpdatedAt time.Time
}

EditTime timestamp

type Option

type Option struct {
	ID    int `gorm:"primary_key;AUTO_INCREMENT"`
	Name  string
	Value string
	EditTime
}

Option bot 设置

type Source

type Source struct {
	ID         uint `gorm:"primary_key;AUTO_INCREMENT"`
	Link       string
	Title      string
	ErrorCount uint
	Content    []Content
	EditTime
}

func FindOrNewSourceByUrl

func FindOrNewSourceByUrl(url string) (*Source, error)

func GetSources

func GetSources() (sources []*Source)

func GetSubscribedNormalSources

func GetSubscribedNormalSources() []*Source

func (*Source) AddErrorCount

func (s *Source) AddErrorCount()

func (*Source) EraseErrorCount

func (s *Source) EraseErrorCount()

func (*Source) IsSubscribed

func (s *Source) IsSubscribed() bool

func (*Source) NeedUpdate

func (s *Source) NeedUpdate() bool

func (*Source) Save

func (s *Source) Save()

type Subscribe

type Subscribe struct {
	ID                 uint `gorm:"primary_key;AUTO_INCREMENT"`
	UserID             int64
	SourceID           uint
	EnableNotification int
	EnableTelegraph    int
	Tag                string
	Interval           int
	WaitTime           int
	EditTime
}

func GetSubscriberBySource

func GetSubscriberBySource(s *Source) []*Subscribe

func (*Subscribe) Unsub

func (s *Subscribe) Unsub() error

type User

type User struct {
	ID int64 `gorm:"primary_key"`
	EditTime
}

User subscriber

Jump to

Keyboard shortcuts

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