Documentation ¶
Index ¶
- type AccessKeys
- type Area
- type Config
- type Database
- func (db *Database) CleanupAccessKeys(duration time.Duration) (int64, error)
- func (db *Database) CleanupPlayURLCache(duration time.Duration) (int64, error)
- func (db *Database) CleanupTHSeasonCache(duration time.Duration) (int64, error)
- func (db *Database) CleanupTHSubtitleCache(duration time.Duration) (int64, error)
- func (db *Database) CleanupUsers(duration time.Duration) (int64, error)
- func (db *Database) GetKey(key string) (*AccessKeys, error)
- func (db *Database) GetPlayURLCache(deviceType DeviceType, area Area, isVIP bool, cid int, episodeID int) (*PlayURLCache, error)
- func (db *Database) GetTHSeasonCache(seasonID int, isVIP bool) (*THSeasonCache, error)
- func (db *Database) GetTHSeasonEpisodeCache(episodeID int, isVIP bool) (*THSeasonCache, error)
- func (db *Database) GetTHSubtitleCache(episodeID int) (*THSubtitleCache, error)
- func (db *Database) GetUser(uid int) (*Users, error)
- func (db *Database) InsertOrUpdateKey(key string, uid int) (int64, error)
- func (db *Database) InsertOrUpdatePlayURLCache(deviceType DeviceType, area Area, isVIP bool, cid int, episodeID int, ...) (int64, error)
- func (db *Database) InsertOrUpdateTHSeasonCache(seasonID int, isVIP bool, jsonData string) (int64, error)
- func (db *Database) InsertOrUpdateTHSeasonEpisodeCache(episodeID int, seasonID int, isVIP bool) (int64, error)
- func (db *Database) InsertOrUpdateTHSubtitleCache(episodeID int, jsonData string) (int64, error)
- func (db *Database) InsertOrUpdateUser(uid int, name string, vipDueDate time.Time) (int64, error)
- type DeviceType
- type PlayURLCache
- type THSeasonCache
- type THSeasonEpisodeCache
- type THSubtitleCache
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessKeys ¶
type AccessKeys struct { // gorm.Model Key string `gorm:"column:key; primarykey"` // key UID int `gorm:"column:uid"` // 用户 ID CreatedAt time.Time `gorm:"column:created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at"` // 更新时间 }
AccessKeys key 缓存
type Database ¶
Database database helper
func NewDBConnection ¶
NewDBConnection new database connection
func (*Database) CleanupAccessKeys ¶
CleanupAccessKeys cleanup access keys if exceeds duration
func (*Database) CleanupPlayURLCache ¶
CleanupPlayURLCache cleanup playurl if exceeds duration
func (*Database) CleanupTHSeasonCache ¶
CleanupTHSeasonCache cleanup th season if exceeds duration
func (*Database) CleanupTHSubtitleCache ¶
CleanupTHSubtitleCache cleanup th subtitle if exceeds duration
func (*Database) CleanupUsers ¶
CleanupUsers cleanup users if exceeds duration
func (*Database) GetKey ¶
func (db *Database) GetKey(key string) (*AccessKeys, error)
GetKey get access key data
func (*Database) GetPlayURLCache ¶
func (db *Database) GetPlayURLCache(deviceType DeviceType, area Area, isVIP bool, cid int, episodeID int) (*PlayURLCache, error)
GetPlayURLCache get play url caching with device type, area, cid or episode ID
func (*Database) GetTHSeasonCache ¶
func (db *Database) GetTHSeasonCache(seasonID int, isVIP bool) (*THSeasonCache, error)
GetTHSeasonCache get season api cache from season id
func (*Database) GetTHSeasonEpisodeCache ¶ added in v1.4.0
func (db *Database) GetTHSeasonEpisodeCache(episodeID int, isVIP bool) (*THSeasonCache, error)
GetTHSeasonCache get season api cache from episode id
func (*Database) GetTHSubtitleCache ¶
func (db *Database) GetTHSubtitleCache(episodeID int) (*THSubtitleCache, error)
GetTHSubtitleCache get th subtitle api cache from season id
func (*Database) InsertOrUpdateKey ¶
InsertOrUpdateKey insert or update access key data
func (*Database) InsertOrUpdatePlayURLCache ¶
func (db *Database) InsertOrUpdatePlayURLCache(deviceType DeviceType, area Area, isVIP bool, cid int, episodeID int, jsonData string) (int64, error)
InsertOrUpdatePlayURLCache insert or update play url cache data
func (*Database) InsertOrUpdateTHSeasonCache ¶
func (db *Database) InsertOrUpdateTHSeasonCache(seasonID int, isVIP bool, jsonData string) (int64, error)
InsertOrUpdateTHSeasonCache insert or update season api cache
func (*Database) InsertOrUpdateTHSeasonEpisodeCache ¶ added in v1.4.0
func (db *Database) InsertOrUpdateTHSeasonEpisodeCache(episodeID int, seasonID int, isVIP bool) (int64, error)
InsertOrUpdateTHSeasonCache insert or update season api cache
func (*Database) InsertOrUpdateTHSubtitleCache ¶
InsertOrUpdateTHSubtitleCache insert or update th subtitle api cache
type DeviceType ¶
type DeviceType int
DeviceType 装置种类
const ( DeviceTypeWeb DeviceType = iota DeviceTypeAndroid )
DeviceType
type PlayURLCache ¶
type PlayURLCache struct { ID uint `gorm:"column:id; primarykey"` // ... IsVip *bool `gorm:"column:is_vip; default:false"` // 大会员 CID int `gorm:"column:cid"` // cid Area Area `gorm:"column:area"` // 地区 DeviceType DeviceType `gorm:"column:device_type"` // 装置种类 EpisodeID int `gorm:"column:episode_id"` // 剧集 ID JSONData string `gorm:"column:json_data"` // 内容 CreatedAt time.Time `gorm:"column:created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at"` // 更新时间 }
PlayURLCache 播放链接缓存
type THSeasonCache ¶
type THSeasonCache struct { SeasonID int `gorm:"column:season_id; primarykey"` // ... IsVip *bool `gorm:"column:is_vip; default:false"` // 大会员 JSONData string `gorm:"column:json_data"` // 内容 CreatedAt time.Time `gorm:"column:created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at"` // 更新时间 }
THSeasonCache season 缓存
type THSeasonEpisodeCache ¶ added in v1.4.0
type THSeasonEpisodeCache struct { EpisodeID int `gorm:"column:episode_id; primarykey"` // ... SeasonID int `gorm:"column:season_id"` // ... CreatedAt time.Time `gorm:"column:created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at"` // 更新时间 }
THSeasonEpisodeCache season episode ID 缓存
type THSubtitleCache ¶
type THSubtitleCache struct { EpisodeID int `gorm:"column:episode_id; primarykey"` // ... JSONData string `gorm:"column:json_data"` // 内容 CreatedAt time.Time `gorm:"column:created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at"` // 更新时间 }
THSubtitleCache 字幕缓存
type Users ¶
type Users struct { UID int `gorm:"column:uid; primarykey"` // 用户 ID VIPDueDate time.Time `gorm:"column:vip_due_date"` // VIP 到期时间 Name string `gorm:"column:name"` // 用户暱称 CreatedAt time.Time `gorm:"column:created_at"` // 创建时间 UpdatedAt time.Time `gorm:"column:updated_at"` // 更新时间 }
Users 用户资料