Documentation
¶
Overview ¶
Package domain rsshub领域逻辑
Index ¶
- type RssClientView
- type RssContent
- type RssDomain
- func (repo *RssDomain) GetSubscribedChannelsByGroupID(ctx context.Context, gid int64) ([]*RssClientView, error)
- func (repo *RssDomain) Subscribe(ctx context.Context, gid int64, feedPath string) (rv *RssClientView, isChannelExisted, isSubExisted bool, err error)
- func (repo *RssDomain) Sync(ctx context.Context) (groupView map[int64][]*RssClientView, err error)
- func (repo *RssDomain) Unsubscribe(ctx context.Context, gid int64, feedPath string) (err error)
- type RssHubClient
- type RssSource
- type RssSubscribe
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RssClientView ¶
type RssClientView struct {
Source *RssSource
Contents []*RssContent
}
RssClientView 频道视图
type RssContent ¶
type RssContent struct {
// Id 自增id
ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT"`
HashID string `gorm:"column:hash_id;unique" json:"hash_id"`
RssSourceID int64 `gorm:"column:rss_source_id;not null" json:"rss_source_id"`
Title string `gorm:"column:title" json:"title"`
Description string `gorm:"column:description" json:"description"`
Link string `gorm:"column:link" json:"link"`
Date time.Time `gorm:"column:date" json:"date"`
Author string `gorm:"column:author" json:"author"`
Thumbnail string `gorm:"column:thumbnail" json:"thumbnail"`
Content string `gorm:"column:content" json:"content"`
// Mtime update time
Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"`
}
RssContent 订阅的RSS频道的推送信息
type RssDomain ¶
type RssDomain struct {
// contains filtered or unexported fields
}
RssDomain RssRepo定义
func NewRssDomain ¶
NewRssDomain 新建RssDomain,调用方保证单例模式
func (*RssDomain) GetSubscribedChannelsByGroupID ¶
func (repo *RssDomain) GetSubscribedChannelsByGroupID(ctx context.Context, gid int64) ([]*RssClientView, error)
GetSubscribedChannelsByGroupID 获取群对应的订阅的频道信息
func (*RssDomain) Subscribe ¶
func (repo *RssDomain) Subscribe(ctx context.Context, gid int64, feedPath string) ( rv *RssClientView, isChannelExisted, isSubExisted bool, err error)
Subscribe QQ群订阅Rss频道
type RssHubClient ¶
RssHubClient rss hub client (http)
type RssSource ¶
type RssSource struct {
// Id 自增id
ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT"`
// RssHubFeedPath 频道路由 用于区分rss_hub 不同的频道 例如: `/bangumi/tv/calendar/today`
RssHubFeedPath string `gorm:"column:rss_hub_feed_path;not null;unique;" json:"rss_hub_feed_path"`
// Title 频道标题
Title string `gorm:"column:title" json:"title"`
// ChannelDesc 频道描述
ChannelDesc string `gorm:"column:channel_desc" json:"channel_desc"`
// ImageURL 频道图片
ImageURL string `gorm:"column:image_url" json:"image_url"`
// Link 频道链接
Link string `gorm:"column:link" json:"link"`
// UpdatedParsed RSS页面更新时间
UpdatedParsed time.Time `gorm:"column:updated_parsed" json:"updated_parsed"`
// Mtime update time
Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"`
}
RssSource RSS频道
func (RssSource) IfNeedUpdate ¶
IfNeedUpdate ...
type RssSubscribe ¶
type RssSubscribe struct {
// Id 自增id
ID int64 `gorm:"column:id;primary_key;AUTO_INCREMENT"`
// 订阅群组
GroupID int64 `gorm:"column:group_id;not null;uniqueIndex:uk_sid_gid"`
// 订阅频道
RssSourceID int64 `gorm:"column:rss_source_id;not null;uniqueIndex:uk_sid_gid"`
// Mtime update time
Mtime time.Time `gorm:"column:mtime;default:current_timestamp;" json:"mtime"`
}
RssSubscribe 订阅关系表:群组-RSS频道
Click to show internal directories.
Click to hide internal directories.