Documentation ¶
Index ¶
- Constants
- func ActiveSourcesByUserID(userID int64) error
- func DeleteContentsBySourceID(sid uint)
- func Disconnect()
- func InitDB()
- func PauseSourcesByUserID(userID int64) error
- func ProcessWechatURL(urlStr string) string
- func PublishItem(source *Source, item *rss.Item, html string) string
- func RegistFeed(userID int64, sourceID uint) error
- func UnsubAllByUserID(userID int64) (success int, fail int, err error)
- func UnsubByUserIDAndSource(userID int64, source *Source) error
- func UnsubByUserIDAndSourceURL(userID int64, url string) error
- func UnsubByUserIDAndSubID(userID int64, subID uint) error
- type Content
- type EditTime
- type Option
- type Source
- func FindOrNewSourceByUrl(url string) (*Source, error)
- func GetErrorSourcesByUserID(userID int64) ([]Source, error)
- func GetSourceById(id uint) (*Source, error)
- func GetSourceByUrl(url string) (*Source, error)
- func GetSources() (sources []*Source)
- func GetSourcesByUserID(userID int64) ([]Source, error)
- func GetSubscribedNormalSources() []*Source
- func (s *Source) AddErrorCount()
- func (s *Source) DeleteContents()
- func (s *Source) DeleteDueNoSubscriber()
- func (s *Source) EraseErrorCount()
- func (s *Source) GetNewContents() ([]*Content, error)
- func (s *Source) GetSubscribeNum() int
- func (s *Source) IsSubscribed() bool
- func (s *Source) NeedUpdate() bool
- func (s *Source) Save()
- func (s *Source) ToggleEnabled() error
- type Subscribe
- func GetSubByUserIDAndURL(userID int64, url string) (*Subscribe, error)
- func GetSubsByUserID(userID int64) ([]Subscribe, error)
- func GetSubscribeByID(id int) (*Subscribe, error)
- func GetSubscribeByUserIDAndSourceID(userID int64, sourceID uint) (*Subscribe, error)
- func GetSubscribeByUserIDAndURL(userID int, url string) (*Subscribe, error)
- func GetSubscriberBySource(s *Source) []*Subscribe
- type User
Constants ¶
View Source
const (
MaxSubscribeTagLength = 250
)
Variables ¶
This section is empty.
Functions ¶
func ActiveSourcesByUserID ¶
func DeleteContentsBySourceID ¶
func DeleteContentsBySourceID(sid uint)
DeleteContentsBySourceID delete contents in the db by sourceID
func PauseSourcesByUserID ¶
func ProcessWechatURL ¶
ProcessWechatURL return wechat-fetcher sub URL. if it's valid wehchat url, else return origin str
func PublishItem ¶
PublishItem publish item to telegraph
func RegistFeed ¶
func UnsubByUserIDAndSource ¶
func UnsubByUserIDAndSubID ¶
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
type Source ¶
type Source struct { ID uint `gorm:"primary_key;AUTO_INCREMENT"` Link string Title string ErrorCount uint Content []Content EditTime }
func FindOrNewSourceByUrl ¶
func GetErrorSourcesByUserID ¶
func GetSourceById ¶
func GetSourceByUrl ¶
func GetSources ¶
func GetSources() (sources []*Source)
func GetSourcesByUserID ¶
func GetSubscribedNormalSources ¶
func GetSubscribedNormalSources() []*Source
func (*Source) AddErrorCount ¶
func (s *Source) AddErrorCount()
func (*Source) DeleteContents ¶
func (s *Source) DeleteContents()
func (*Source) DeleteDueNoSubscriber ¶
func (s *Source) DeleteDueNoSubscriber()
func (*Source) EraseErrorCount ¶
func (s *Source) EraseErrorCount()
func (*Source) GetNewContents ¶
GetNewContents 获取rss新内容
func (*Source) GetSubscribeNum ¶
func (*Source) IsSubscribed ¶
func (*Source) NeedUpdate ¶
func (*Source) ToggleEnabled ¶
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 GetSubsByUserID ¶
func GetSubscribeByID ¶
func GetSubscriberBySource ¶
func (*Subscribe) SetInterval ¶
func (*Subscribe) ToggleNotification ¶
func (*Subscribe) ToggleTelegraph ¶
type User ¶
type User struct { ID int64 `gorm:"primary_key"` TelegramID int64 Source []Source `gorm:"many2many:subscribes;"` State int `gorm:"DEFAULT:0;"` EditTime }
User subscriber
TelegramID 用作外键
func FindOrCreateUserByTelegramID ¶
FindOrCreateUserByTelegramID find subscriber or init a subscriber by telegram ID
func FindOrInitUser
deprecated
Click to show internal directories.
Click to hide internal directories.