Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiResultJSON ¶
type ApiResultJSON struct { Torrents []TorrentJSON `json:"torrents"` QueryRecordCount int `json:"queryRecordCount"` TotalRecordCount int `json:"totalRecordCount"` }
type Comment ¶
type Comment struct { ID uint `gorm:"column:comment_id;primary_key"` TorrentID uint `gorm:"column:torrent_id"` UserID uint `gorm:"column:user_id"` Content string `gorm:"column:content"` CreatedAt time.Time `gorm:"column:created_at"` UpdatedAt time.Time `gorm:"column:updated_at"` DeletedAt *time.Time Torrent *Torrent `gorm:"AssociationForeignKey:TorrentID;ForeignKey:torrent_id"` User *User `gorm:"AssociationForeignKey:UserID;ForeignKey:user_id"` }
type CommentJSON ¶
type OldComment ¶
type OldComment struct { TorrentID uint `gorm:"column:torrent_id"` Username string `gorm:"column:username"` Content string `gorm:"column:content"` Date time.Time `gorm:"column:date"` Torrent *Torrent `gorm:"ForeignKey:torrent_id"` }
func (OldComment) Size ¶
func (c OldComment) Size() int
Returns the total size of memory recursively allocated for this struct
func (OldComment) TableName ¶
func (c OldComment) TableName() string
type PublicUser ¶
type PublicUser struct {
User *User
}
type Torrent ¶
type Torrent struct { ID uint `gorm:"column:torrent_id;primary_key"` Name string `gorm:"column:torrent_name"` Hash string `gorm:"column:torrent_hash"` Category int `gorm:"column:category"` SubCategory int `gorm:"column:sub_category"` Status int `gorm:"column:status"` Date time.Time `gorm:"column:date"` UploaderID uint `gorm:"column:uploader"` Downloads int `gorm:"column:downloads"` Stardom int `gorm:"column:stardom"` Filesize int64 `gorm:"column:filesize"` Description string `gorm:"column:description"` WebsiteLink string `gorm:"column:website_link"` DeletedAt *time.Time Uploader *User `gorm:"ForeignKey:uploader"` OldUploader string `gorm:"-"` // ??????? OldComments []OldComment `gorm:"ForeignKey:torrent_id"` Comments []Comment `gorm:"ForeignKey:torrent_id"` Seeders uint32 `gorm:"column:seeders"` Leechers uint32 `gorm:"column:leechers"` Completed uint32 `gorm:"column:completed"` LastScrape time.Time `gorm:"column:last_scrape"` }
func (Torrent) Size ¶
Returns the total size of memory recursively allocated for this struct FIXME: doesn't go have sizeof or something nicer for this?
func (*Torrent) ToJSON ¶
func (t *Torrent) ToJSON() TorrentJSON
ToJSON converts a model.Torrent to its equivalent JSON structure
type TorrentJSON ¶
type TorrentJSON struct { ID string `json:"id"` Name string `json:"name"` Status int `json:"status"` Hash string `json:"hash"` Date string `json:"date"` Filesize string `json:"filesize"` Description template.HTML `json:"description"` Comments []CommentJSON `json:"comments"` SubCategory string `json:"sub_category"` Category string `json:"category"` Downloads int `json:"downloads"` UploaderID uint `json:"uploader_id"` UploaderName template.HTML `json:"uploader_name"` OldUploader template.HTML `json:"uploader_old"` WebsiteLink template.URL `json:"website_link"` Magnet template.URL `json:"magnet"` TorrentLink template.URL `json:"torrent"` Seeders uint32 `json:"seeders"` Leechers uint32 `json:"leechers"` Completed uint32 `json:"completed"` LastScrape time.Time `json:"last_scrape"` }
func TorrentsToJSON ¶
func TorrentsToJSON(t []Torrent) []TorrentJSON
Map Torrents to TorrentsToJSON without reallocations
type TorrentReport ¶
type TorrentReport struct { ID uint `gorm:"column:torrent_report_id;primary_key"` Description string `gorm:"column:type"` TorrentID uint `gorm:"column:torrent_id"` UserID uint `gorm:"column:user_id"` CreatedAt time.Time `gorm:"column:created_at"` Torrent *Torrent `gorm:"AssociationForeignKey:TorrentID;ForeignKey:torrent_id"` User *User `gorm:"AssociationForeignKey:UserID;ForeignKey:user_id"` }
TODO Add field to specify kind of reports TODO Add CreatedAt field INFO User can be null (anonymous reports) FIXME can't preload field Torrents for model.TorrentReport
func (*TorrentReport) ToJson ¶
func (report *TorrentReport) ToJson() TorrentReportJson
type TorrentReportJson ¶
type TorrentReportJson struct { ID uint `json:"id"` Description string `json:"description"` Torrent TorrentJSON `json:"torrent"` User UserJSON `json:"user"` }
func TorrentReportsToJSON ¶
func TorrentReportsToJSON(reports []TorrentReport) []TorrentReportJson
type User ¶
type User struct { ID uint `gorm:"column:user_id;primary_key"` Username string `gorm:"column:username"` Password string `gorm:"column:password"` Email string `gorm:"column:email"` Status int `gorm:"column:status"` CreatedAt time.Time `gorm:"column:created_at"` UpdatedAt time.Time `gorm:"column:updated_at"` ApiToken string `gorm:"column:api_token"` ApiTokenExpiry time.Time `gorm:"column:api_token_expiry"` Language string `gorm:"column:language"` // TODO: move this to PublicUser LikingCount int `json:"likingCount" gorm:"-"` LikedCount int `json:"likedCount" gorm:"-"` Likings []User // Don't work `gorm:"foreignkey:user_id;associationforeignkey:follower_id;many2many:user_follows"` Liked []User // Don't work `gorm:"foreignkey:follower_id;associationforeignkey:user_id;many2many:user_follows"` MD5 string `json:"md5" gorm:"column:md5"` // Hash of email address, used for Gravatar Torrents []Torrent `gorm:"ForeignKey:UploaderID"` }
type UserFollows ¶
type UserFollows struct { UserID uint `gorm:"column:user_id"` FollowerID uint `gorm:"column:following"` }
different users following eachother
type UserUploadsOld ¶
type UserUploadsOld struct { Username string `gorm:"column:username"` TorrentId uint `gorm:"column:torrent_id"` }
func (UserUploadsOld) TableName ¶
func (c UserUploadsOld) TableName() string
Click to show internal directories.
Click to hide internal directories.