Documentation
¶
Index ¶
- type Admin
- type ApiKey
- type Artist
- type Artwork
- func (a *Artwork) BeforeCreate(tx *gorm.DB) (err error)
- func (a *Artwork) FirstMedia() shared.MediaLike
- func (a *Artwork) GetArtist() shared.ArtistLike
- func (a *Artwork) GetDescription() string
- func (a *Artwork) GetID() string
- func (a *Artwork) GetPictures() []shared.PictureLike
- func (a *Artwork) GetR18() bool
- func (a *Artwork) GetSourceURL() string
- func (a *Artwork) GetTags() []string
- func (a *Artwork) GetTagsWithAlias() []string
- func (a *Artwork) GetTitle() string
- func (a *Artwork) GetType() shared.SourceType
- func (a *Artwork) GetUgoiraMetas() []shared.UgoiraMetaLike
- func (a *Artwork) GetVideos() []shared.VideoLike
- func (a *Artwork) MediasCount() int
- type CachedArtist
- type CachedArtwork
- func (c *CachedArtwork) BeforeCreate(tx *gorm.DB) (err error)
- func (c *CachedArtwork) FirstMedia() shared.MediaLike
- func (c *CachedArtwork) GetArtist() shared.ArtistLike
- func (c *CachedArtwork) GetDescription() string
- func (c *CachedArtwork) GetID() string
- func (c *CachedArtwork) GetPictures() []shared.PictureLike
- func (c *CachedArtwork) GetR18() bool
- func (c *CachedArtwork) GetSourceURL() string
- func (c *CachedArtwork) GetTags() []string
- func (c *CachedArtwork) GetTitle() string
- func (c *CachedArtwork) GetType() shared.SourceType
- func (c *CachedArtwork) GetUgoiraMetas() []shared.UgoiraMetaLike
- func (c *CachedArtwork) GetVideos() []shared.VideoLike
- func (c *CachedArtwork) MediasCount() int
- type CachedArtworkData
- func (c *CachedArtworkData) FirstMedia() shared.MediaLike
- func (c *CachedArtworkData) GetArtist() shared.ArtistLike
- func (c *CachedArtworkData) GetDescription() string
- func (c *CachedArtworkData) GetID() string
- func (c *CachedArtworkData) GetPictures() []shared.PictureLike
- func (c *CachedArtworkData) GetR18() bool
- func (c *CachedArtworkData) GetSourceURL() string
- func (c *CachedArtworkData) GetTags() []string
- func (c *CachedArtworkData) GetTitle() string
- func (c *CachedArtworkData) GetType() shared.SourceType
- func (c *CachedArtworkData) GetUgoiraMetas() []shared.UgoiraMetaLike
- func (c *CachedArtworkData) GetVideos() []shared.VideoLike
- func (c *CachedArtworkData) GetViewablePictures() []*CachedPicture
- func (c *CachedArtworkData) MediasCount() int
- type CachedPicture
- func (c *CachedPicture) GetIndex() uint
- func (c *CachedPicture) GetOriginal() string
- func (c *CachedPicture) GetSize() (width uint, height uint)
- func (c *CachedPicture) GetStorageInfo() shared.StorageInfo
- func (c *CachedPicture) GetTelegramInfo() shared.TelegramInfo
- func (c *CachedPicture) GetThumbnail() string
- func (c *CachedPicture) IsHide() bool
- type CachedUgoiraMeta
- type CachedVideo
- func (c *CachedVideo) GetDuration() uint
- func (c *CachedVideo) GetHeight() uint
- func (c *CachedVideo) GetIndex() uint
- func (c *CachedVideo) GetMimeType() string
- func (c *CachedVideo) GetOriginalStorage() shared.StorageDetail
- func (c *CachedVideo) GetPoster() string
- func (c *CachedVideo) GetTelegramInfo() shared.TelegramInfo
- func (c *CachedVideo) GetURL() string
- func (c *CachedVideo) GetWidth() uint
- type DeletedRecord
- type Picture
- func (p *Picture) BeforeCreate(tx *gorm.DB) (err error)
- func (p *Picture) GetIndex() uint
- func (p *Picture) GetOriginal() string
- func (p *Picture) GetSize() (width uint, height uint)
- func (p *Picture) GetStorageInfo() shared.StorageInfo
- func (p *Picture) GetTelegramInfo() shared.TelegramInfo
- func (p *Picture) GetThumbnail() string
- func (p *Picture) IsHide() bool
- type Tag
- type TagAlias
- type UgoiraMeta
- type User
- type UserSettings
- type Video
- func (v *Video) BeforeCreate(tx *gorm.DB) (err error)
- func (v *Video) GetDuration() uint
- func (v *Video) GetHeight() uint
- func (v *Video) GetIndex() uint
- func (v *Video) GetMimeType() string
- func (v *Video) GetOriginalStorage() shared.StorageDetail
- func (v *Video) GetPoster() string
- func (v *Video) GetTelegramInfo() shared.TelegramInfo
- func (v *Video) GetURL() string
- func (v *Video) GetWidth() uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct {
Permissions datatypes.JSONSlice[shared.Permission] `json:"permissions"`
TelegramID int64 `gorm:"index" json:"telegram_id"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
}
func (*Admin) HasPermission ¶
func (a *Admin) HasPermission(perm shared.Permission) bool
type ApiKey ¶
type ApiKey struct {
Key string `gorm:"type:text;not null;uniqueIndex" json:"key"`
Description string `gorm:"type:text" json:"description"`
Permissions datatypes.JSONSlice[shared.Permission] `gorm:"type:json" json:"permissions"`
Quota int `gorm:"not null;default:0" json:"quota"`
Used int `gorm:"not null;default:0" json:"used"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
}
func (*ApiKey) HasPermission ¶
func (a *ApiKey) HasPermission(p shared.Permission) bool
type Artist ¶
type Artist struct {
Name string `gorm:"type:text;not null;index" json:"name"`
Type shared.SourceType `gorm:"type:text;not null;index" json:"type"`
UID string `gorm:"type:text;not null;index" json:"uid"`
Username string `gorm:"type:text;not null;index" json:"username"`
// reverse relation
Artworks []*Artwork `gorm:"foreignKey:ArtistID" json:"-"` // json ignore to avoid circular reference
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
}
func (*Artist) GetUserName ¶
GetUserName implements shared.ArtistLike.
type Artwork ¶
type Artwork struct {
CreatedAt time.Time `gorm:"not null;autoCreateTime;index:idx_artwork_created_at,sort:desc" json:"created_at"`
UpdatedAt time.Time `gorm:"not null;autoUpdateTime" json:"updated_at"`
Artist *Artist `gorm:"foreignKey:ArtistID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL" json:"artist"`
Title string `gorm:"type:text;not null;index:idx_artwork_title,sort:asc" json:"title"`
Description string `gorm:"type:text" json:"description"`
SourceType shared.SourceType `gorm:"type:text;not null;index:idx_artwork_source_type" json:"source_type"`
SourceURL string `gorm:"type:text;not null;uniqueIndex" json:"source_url"`
// many2many relationship with tags
Tags []*Tag `gorm:"many2many:artwork_tags;constraint:OnDelete:CASCADE" json:"tags"`
// one-to-many pictures
Pictures []*Picture `gorm:"foreignKey:ArtworkID;constraint:OnDelete:CASCADE" json:"pictures"`
// https://www.pixiv.help/hc/en-us/articles/235584628-What-are-Ugoira
// one-to-many ugoira meta, usually only one
UgoiraMetas []*UgoiraMeta `gorm:"foreignKey:ArtworkID;constraint:OnDelete:CASCADE" json:"ugoira_meta,omitempty"`
// one-to-many videos
Videos []*Video `gorm:"foreignKey:ArtworkID;constraint:OnDelete:CASCADE" json:"videos"`
LikeCount uint `gorm:"not null;default:0" json:"like_count"`
// keep ObjectID as 24-hex string
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
ArtistID ouid.OUID `gorm:"type:uuid;index" json:"artist_id"`
R18 bool `gorm:"not null;default:false;index:idx_artwork_r18" json:"r18"`
}
func (*Artwork) FirstMedia ¶ added in v1.5.0
func (*Artwork) GetArtist ¶
func (a *Artwork) GetArtist() shared.ArtistLike
GetArtist implements ArtworkLike.
func (*Artwork) GetDescription ¶
GetDescription implements ArtworkLike.
func (*Artwork) GetPictures ¶
func (a *Artwork) GetPictures() []shared.PictureLike
GetPictures implements ArtworkLike.
func (*Artwork) GetSourceURL ¶
GetSourceURL implements ArtworkLike.
func (*Artwork) GetTagsWithAlias ¶
func (*Artwork) GetType ¶
func (a *Artwork) GetType() shared.SourceType
GetType implements shared.ArtworkLike.
func (*Artwork) GetUgoiraMetas ¶
func (a *Artwork) GetUgoiraMetas() []shared.UgoiraMetaLike
GetUgoiraMetas implements shared.UgoiraArtworkLike.
func (*Artwork) GetVideos ¶ added in v1.5.0
GetVideos implements shared.ArtworkLike.
func (*Artwork) MediasCount ¶ added in v1.5.0
MediasCount implements shared.ArtworkLike.
type CachedArtist ¶
type CachedArtist struct {
ID string `json:"id"`
Name string `json:"name"`
Type shared.SourceType `json:"type"`
UID string `json:"uid"`
Username string `json:"username"`
}
func (*CachedArtist) GetName ¶
func (c *CachedArtist) GetName() string
GetName implements shared.ArtistLike.
func (*CachedArtist) GetUID ¶
func (c *CachedArtist) GetUID() string
GetUID implements shared.ArtistLike.
func (*CachedArtist) GetUserName ¶
func (c *CachedArtist) GetUserName() string
GetUserName implements shared.ArtistLike.
type CachedArtwork ¶
type CachedArtwork struct {
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
Artwork datatypes.JSONType[*CachedArtworkData] `gorm:"type:json" json:"artwork"`
SourceURL string `gorm:"type:text;uniqueIndex" json:"source_url"`
Status shared.ArtworkStatus `gorm:"type:text;index" json:"status"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
}
func (*CachedArtwork) BeforeCreate ¶
func (c *CachedArtwork) BeforeCreate(tx *gorm.DB) (err error)
func (*CachedArtwork) FirstMedia ¶ added in v1.5.0
func (c *CachedArtwork) FirstMedia() shared.MediaLike
FirstMedia implements shared.ArtworkLike.
func (*CachedArtwork) GetArtist ¶
func (c *CachedArtwork) GetArtist() shared.ArtistLike
GetArtist implements ArtworkLike.
func (*CachedArtwork) GetDescription ¶
func (c *CachedArtwork) GetDescription() string
GetDescription implements ArtworkLike.
func (*CachedArtwork) GetID ¶
func (c *CachedArtwork) GetID() string
func (*CachedArtwork) GetPictures ¶
func (c *CachedArtwork) GetPictures() []shared.PictureLike
GetPictures implements ArtworkLike.
func (*CachedArtwork) GetR18 ¶
func (c *CachedArtwork) GetR18() bool
func (*CachedArtwork) GetSourceURL ¶
func (c *CachedArtwork) GetSourceURL() string
GetSourceURL implements ArtworkLike.
func (*CachedArtwork) GetTags ¶
func (c *CachedArtwork) GetTags() []string
GetTags implements ArtworkLike.
func (*CachedArtwork) GetTitle ¶
func (c *CachedArtwork) GetTitle() string
GetTitle implements ArtworkLike.
func (*CachedArtwork) GetType ¶
func (c *CachedArtwork) GetType() shared.SourceType
GetType implements shared.ArtworkLike.
func (*CachedArtwork) GetUgoiraMetas ¶
func (c *CachedArtwork) GetUgoiraMetas() []shared.UgoiraMetaLike
GetUgoiraMetas implements shared.UgoiraArtworkLike.
func (*CachedArtwork) GetVideos ¶ added in v1.5.0
func (c *CachedArtwork) GetVideos() []shared.VideoLike
GetVideos implements shared.ArtworkLike.
func (*CachedArtwork) MediasCount ¶ added in v1.5.0
func (c *CachedArtwork) MediasCount() int
type CachedArtworkData ¶
type CachedArtworkData struct {
Artist *CachedArtist `json:"artist"`
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
SourceType shared.SourceType `json:"source_type"`
SourceURL string `json:"source_url"`
Tags []string `json:"tags"`
Pictures []*CachedPicture `json:"pictures"`
UgoiraMetas []*CachedUgoiraMeta `json:"ugoira_metas,omitempty"`
Videos []*CachedVideo `json:"videos,omitempty"`
Version int `json:"version"` // for future schema changes
R18 bool `json:"r18"`
}
func (*CachedArtworkData) FirstMedia ¶ added in v1.5.0
func (c *CachedArtworkData) FirstMedia() shared.MediaLike
FirstMedia implements shared.ArtworkLike.
func (*CachedArtworkData) GetArtist ¶
func (c *CachedArtworkData) GetArtist() shared.ArtistLike
GetArtist implements ArtworkLike.
func (*CachedArtworkData) GetDescription ¶
func (c *CachedArtworkData) GetDescription() string
GetDescription implements ArtworkLike.
func (*CachedArtworkData) GetID ¶
func (c *CachedArtworkData) GetID() string
func (*CachedArtworkData) GetPictures ¶
func (c *CachedArtworkData) GetPictures() []shared.PictureLike
GetPictures implements ArtworkLike.
func (*CachedArtworkData) GetR18 ¶
func (c *CachedArtworkData) GetR18() bool
GetR18 implements ArtworkLike.
func (*CachedArtworkData) GetSourceURL ¶
func (c *CachedArtworkData) GetSourceURL() string
GetSourceURL implements ArtworkLike.
func (*CachedArtworkData) GetTags ¶
func (c *CachedArtworkData) GetTags() []string
GetTags implements ArtworkLike.
func (*CachedArtworkData) GetTitle ¶
func (c *CachedArtworkData) GetTitle() string
GetTitle implements ArtworkLike.
func (*CachedArtworkData) GetType ¶
func (c *CachedArtworkData) GetType() shared.SourceType
func (*CachedArtworkData) GetUgoiraMetas ¶
func (c *CachedArtworkData) GetUgoiraMetas() []shared.UgoiraMetaLike
GetUgoiraMetas implements shared.UgoiraArtworkLike.
func (*CachedArtworkData) GetVideos ¶ added in v1.5.0
func (c *CachedArtworkData) GetVideos() []shared.VideoLike
GetVideos implements shared.ArtworkLike.
func (*CachedArtworkData) GetViewablePictures ¶
func (c *CachedArtworkData) GetViewablePictures() []*CachedPicture
func (*CachedArtworkData) MediasCount ¶ added in v1.5.0
func (c *CachedArtworkData) MediasCount() int
MediasCount implements shared.ArtworkLike.
type CachedPicture ¶
type CachedPicture struct {
StorageInfo shared.StorageInfo `json:"storage_info"`
TelegramInfo shared.TelegramInfo `json:"telegram_info"`
ID string `json:"id"`
ArtworkID string `json:"artwork_id"`
Thumbnail string `json:"thumbnail"`
Original string `json:"original"`
Phash string `json:"phash"` // phash
ThumbHash string `json:"thumb_hash"` // thumbhash
OrderIndex uint `json:"index"`
Width uint `json:"width"`
Height uint `json:"height"`
Hidden bool `json:"hidden"` // 设为 true 时不发布到 Artwork 中, 但仍在其他接口中返回
}
func (*CachedPicture) GetIndex ¶
func (c *CachedPicture) GetIndex() uint
GetIndex implements PictureLike.
func (*CachedPicture) GetOriginal ¶
func (c *CachedPicture) GetOriginal() string
GetOriginal implements PictureLike.
func (*CachedPicture) GetSize ¶
func (c *CachedPicture) GetSize() (width uint, height uint)
GetSize implements PictureLike.
func (*CachedPicture) GetStorageInfo ¶
func (c *CachedPicture) GetStorageInfo() shared.StorageInfo
GetStorageInfo implements PictureLike.
func (*CachedPicture) GetTelegramInfo ¶
func (c *CachedPicture) GetTelegramInfo() shared.TelegramInfo
GetTelegramInfo implements PictureLike.
func (*CachedPicture) GetThumbnail ¶
func (c *CachedPicture) GetThumbnail() string
GetThumbnail implements PictureLike.
type CachedUgoiraMeta ¶
type CachedUgoiraMeta struct {
TelegramInfo shared.TelegramInfo `json:"telegram_info"`
OriginalStorage shared.StorageDetail `json:"original_storage"`
ID string `json:"id"`
ArtworkID string `json:"artwork_id"`
MetaData shared.UgoiraMetaData `json:"data"`
OrderIndex uint `json:"index"`
}
func (*CachedUgoiraMeta) GetData ¶ added in v1.7.0
func (c *CachedUgoiraMeta) GetData() shared.UgoiraMetaData
GetData implements shared.UgoiraMetaLike.
func (*CachedUgoiraMeta) GetIndex ¶
func (c *CachedUgoiraMeta) GetIndex() uint
GetIndex implements shared.UgoiraMetaLike.
func (*CachedUgoiraMeta) GetOriginalStorage ¶
func (c *CachedUgoiraMeta) GetOriginalStorage() shared.StorageDetail
GetOriginalStorage implements shared.UgoiraMetaLike.
func (*CachedUgoiraMeta) GetTelegramInfo ¶
func (c *CachedUgoiraMeta) GetTelegramInfo() shared.TelegramInfo
GetTelegramInfo implements shared.UgoiraMetaLike.
type CachedVideo ¶ added in v1.5.0
type CachedVideo struct {
TelegramInfo shared.TelegramInfo `json:"telegram_info"`
OriginalStorage shared.StorageDetail `json:"original_storage"`
ID string `json:"id"`
ArtworkID string `json:"artwork_id"`
Poster string `json:"poster"`
URL string `json:"original"`
MimeType string `json:"mime_type"`
OrderIndex uint `json:"index"`
Width uint `json:"width"`
Height uint `json:"height"`
Duration uint `json:"duration"` // in milliseconds
}
func (*CachedVideo) GetDuration ¶ added in v1.5.0
func (c *CachedVideo) GetDuration() uint
GetDuration implements shared.VideoLike.
func (*CachedVideo) GetHeight ¶ added in v1.5.0
func (c *CachedVideo) GetHeight() uint
GetHeight implements shared.VideoLike.
func (*CachedVideo) GetIndex ¶ added in v1.5.0
func (c *CachedVideo) GetIndex() uint
GetIndex implements shared.VideoLike.
func (*CachedVideo) GetMimeType ¶ added in v1.5.0
func (c *CachedVideo) GetMimeType() string
GetMimeType implements shared.VideoLike.
func (*CachedVideo) GetOriginalStorage ¶ added in v1.5.0
func (c *CachedVideo) GetOriginalStorage() shared.StorageDetail
GetStorageInfo implements shared.VideoLike.
func (*CachedVideo) GetPoster ¶ added in v1.5.0
func (c *CachedVideo) GetPoster() string
GetPoster implements shared.VideoLike.
func (*CachedVideo) GetTelegramInfo ¶ added in v1.5.0
func (c *CachedVideo) GetTelegramInfo() shared.TelegramInfo
GetTelegramInfo implements shared.VideoLike.
func (*CachedVideo) GetURL ¶ added in v1.5.0
func (c *CachedVideo) GetURL() string
GetURL implements shared.VideoLike.
func (*CachedVideo) GetWidth ¶ added in v1.5.0
func (c *CachedVideo) GetWidth() uint
GetWidth implements shared.VideoLike.
type DeletedRecord ¶
type DeletedRecord struct {
DeletedAt time.Time `gorm:"not null;autoCreateTime" json:"deleted_at"`
SourceURL string `gorm:"type:text;not null;uniqueIndex" json:"source_url"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
}
func (*DeletedRecord) BeforeCreate ¶
func (d *DeletedRecord) BeforeCreate(tx *gorm.DB) (err error)
type Picture ¶
type Picture struct {
StorageInfo datatypes.JSONType[shared.StorageInfo] `json:"storage_info"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
TelegramInfo datatypes.JSONType[shared.TelegramInfo] `json:"telegram_info"`
Artwork *Artwork `gorm:"foreignKey:ArtworkID;references:ID;constraint:OnDelete:CASCADE" json:"-"`
Thumbnail string `gorm:"type:text" json:"thumbnail"`
Original string `gorm:"type:text;index" json:"original"`
Phash string `gorm:"type:text;index" json:"phash"` // phash
ThumbHash string `gorm:"type:text" json:"thumb_hash"` // thumbhash
OrderIndex uint `gorm:"column:order_index;not null;default:0;index:idx_picture_artwork_index,priority:1" json:"index"`
Width uint `json:"width"`
Height uint `json:"height"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
ArtworkID ouid.OUID `gorm:"type:uuid;index" json:"artwork_id"`
}
func (*Picture) GetOriginal ¶
GetOriginal implements PictureLike.
func (*Picture) GetStorageInfo ¶
func (p *Picture) GetStorageInfo() shared.StorageInfo
GetStorageInfo implements PictureLike.
func (*Picture) GetTelegramInfo ¶
func (p *Picture) GetTelegramInfo() shared.TelegramInfo
GetTelegramInfo implements PictureLike.
func (*Picture) GetThumbnail ¶
GetThumbnail implements PictureLike.
type Tag ¶
type Tag struct {
Name string `gorm:"type:text;not null;uniqueIndex" json:"name"`
Alias []TagAlias `gorm:"foreignKey:TagID;constraint:OnDelete:CASCADE" json:"alias"` // one-to-many relation
// reverse relation via many2many
Artworks []*Artwork `gorm:"many2many:artwork_tags" json:"-"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
}
type TagAlias ¶
type UgoiraMeta ¶
type UgoiraMeta struct {
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
TelegramInfo datatypes.JSONType[shared.TelegramInfo] `json:"telegram_info"`
Artwork *Artwork `gorm:"foreignKey:ArtworkID;references:ID;constraint:OnDelete:CASCADE" json:"-"`
OriginalStorage datatypes.JSONType[shared.StorageDetail] `json:"original_storage"`
Data datatypes.JSONType[shared.UgoiraMetaData] `json:"data"`
OrderIndex uint `gorm:"column:order_index;not null;default:0;index:idx_ugoira_artwork_index,priority:1" json:"index"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
ArtworkID ouid.OUID `gorm:"type:uuid;index" json:"artwork_id"`
}
func (*UgoiraMeta) BeforeCreate ¶
func (u *UgoiraMeta) BeforeCreate(tx *gorm.DB) (err error)
func (*UgoiraMeta) GetData ¶ added in v1.7.0
func (u *UgoiraMeta) GetData() shared.UgoiraMetaData
GetData implements shared.UgoiraMetaLike.
func (*UgoiraMeta) GetIndex ¶
func (u *UgoiraMeta) GetIndex() uint
GetIndex implements shared.UgoiraMetaLike.
func (*UgoiraMeta) GetOriginalStorage ¶
func (u *UgoiraMeta) GetOriginalStorage() shared.StorageDetail
GetOriginalStorage implements shared.UgoiraMetaLike.
func (*UgoiraMeta) GetTelegramInfo ¶
func (u *UgoiraMeta) GetTelegramInfo() shared.TelegramInfo
GetTelegramInfo implements shared.UgoiraMetaLike.
type User ¶
type User struct {
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
Email *string `gorm:"type:text;uniqueIndex" json:"email"`
TelegramID *int64 `gorm:"type:bigint;uniqueIndex" json:"telegram_id"`
Settings datatypes.JSONType[*UserSettings] `gorm:"type:json" json:"settings"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
Username string `gorm:"type:text;uniqueIndex" json:"username"`
Password string `gorm:"type:text;not null" json:"password"`
Favorites []*Artwork `gorm:"many2many:user_favorites;constraint:OnDelete:CASCADE" json:"favorites"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
Blocked bool `gorm:"not null;default:false;index" json:"blocked"`
}
只是为了兼容...
V1 里或许永远用不上
type UserSettings ¶
type Video ¶ added in v1.5.0
type Video struct {
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
TelegramInfo datatypes.JSONType[shared.TelegramInfo] `json:"telegram_info"`
Artwork *Artwork `gorm:"foreignKey:ArtworkID;references:ID;constraint:OnDelete:CASCADE" json:"-"`
OriginalStorage datatypes.JSONType[shared.StorageDetail] `json:"original_storage"`
Poster string `gorm:"type:text" json:"poster"` // poster image URL
MimeType string `gorm:"type:text" json:"mime_type"`
URL string `gorm:"type:text;index" json:"url"` // video URL
OrderIndex uint `gorm:"column:order_index;not null;default:0;index:idx_video_artwork_index,priority:1" json:"index"`
Duration uint `json:"duration"` // duration in ms
Width uint `json:"width"`
Height uint `json:"height"`
ID ouid.OUID `gorm:"primaryKey;type:uuid" json:"id"`
ArtworkID ouid.OUID `gorm:"type:uuid;index" json:"artwork_id"`
}
func (*Video) GetDuration ¶ added in v1.5.0
GetDuration implements shared.VideoLike.
func (*Video) GetHeight ¶ added in v1.5.0
GetHeight implements shared.VideoLike.
func (*Video) GetIndex ¶ added in v1.5.0
GetIndex implements shared.VideoLike.
func (*Video) GetMimeType ¶ added in v1.5.0
GetMimeType implements shared.VideoLike.
func (*Video) GetOriginalStorage ¶ added in v1.5.0
func (v *Video) GetOriginalStorage() shared.StorageDetail
GetStorageInfo implements shared.VideoLike.
func (*Video) GetPoster ¶ added in v1.5.0
GetPoster implements shared.VideoLike.
func (*Video) GetTelegramInfo ¶ added in v1.5.0
func (v *Video) GetTelegramInfo() shared.TelegramInfo
GetTelegramInfo implements shared.VideoLike.
func (*Video) GetURL ¶ added in v1.5.0
GetURL implements shared.VideoLike.
func (*Video) GetWidth ¶ added in v1.5.0
GetWidth implements shared.VideoLike.