Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Subscribed ¶
Subscribed function check the record exists or not
func Unsubscribe ¶
Unsubscribe function delete record from subscriber table
Types ¶
type Chapter ¶
type Chapter struct { ID int `gorm:"primary_key" json:"-"` URL string `gorm:"size:128;not null;unique_index" json:"url"` Number int `gorm:"not null;unique_index:uix_chapters_number_comic_id" json:"index"` Title string `gorm:"size:128;not null" json:"title"` Cached bool `gorm:"not null;default:false" json:"-"` Path string `gorm:"size:256"` ComicID int `gorm:"not null;unique_index:uix_chapters_number_comic_id" json:"-"` Created Time `gorm:"type:timestamp;not null;default:current_timestamp" json:"created"` Comic *Comic `gorm:"foreignkey:ComicID;association_foreignkey:ID" json:"-"` Pictures []string `gorm:"-" json:"pictures"` PictureS []*Picture `gorm:"foreignkey:ChapterID;association_foreignkey:ID" json:"-"` }
Chapter mapping table chapters
func AllCachedChapters ¶
func AllCachedChapters() []*Chapter
AllCachedChapters function get all cached chapter information
func GetChapter ¶
GetChapter function get comic record from database
type Comic ¶
type Comic struct { ID int `gorm:"primary_key" json:"id"` URL string `gorm:"size:128;not null;unique_index" json:"url"` Title string `gorm:"size:128;not null;unique_index:uix_comics_title_source" json:"title"` Source string `gorm:"size:32;not null;unique_index:uix_comics_title_source" json:"source"` Cover string `gorm:"size:128;not null" json:"cover"` Summary string `gorm:"type:text" json:"summary"` Latest string `json:"latest"` Created Time `gorm:"type:timestamp;not null;default:current_timestamp" json:"created"` Chapters []*Chapter `gorm:"foreignkey:ComicID;association_foreignkey:ID" json:"chapters"` Users []*User `gorm:"many2many:subscribers" json:"users,omitempty"` }
Comic mapping table comics
func QueryComic ¶
QueryComic function query comic record from database
type Picture ¶
type Picture struct { ID int64 `gorm:"primary_key"` Number int `gorm:"not null" json:"number"` Filename string `gorm:"size:256"` ChapterID int `gorm:"not null;index"` Created Time `gorm:"type:timestamp;not null;default:current_timestamp"` }
Picture mapping table pictures
type Subscriber ¶
type Subscriber struct { UserID int `gorm:"primary_key;index;auto_increment:false"` ComicID int `gorm:"primary_key;index;auto_increment:false"` Created Time `gorm:"type:timestamp;not null;default:current_timestamp"` User *User Comic *Comic }
Subscriber mapping table subscribers
type Time ¶
Time struct custom time formatter
func SubscribeDate ¶
SubscribeDate function return the Time field
type User ¶
type User struct { ID int `gorm:"primary_key"` Email string `gorm:"size:64;not null;unique_index"` Username string `gorm:"size:64;not null;unique_index"` Password string `gorm:"size:128;not null"` Avatar string `gorm:"size:128"` Admin bool `gorm:"not null;default:false"` Blocked bool `gorm:"not null;default:false"` Created Time `gorm:"type:timestamp;not null;default:current_timestamp"` Comics []*Comic `gorm:"many2many:subscribers"` }
User mapping table users
func (*User) ComicSlice ¶
ComicSlice function get all comics subscribed by this user
Click to show internal directories.
Click to hide internal directories.