model

package
v0.0.0-...-3c895b7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPaginatorPerPage = 10

Functions

func Migration

func Migration(db *gorm.DB) (err error)

func RegisterTable

func RegisterTable(v interface{})

Types

type BaseModel

type BaseModel struct {
	ID        string         `gorm:"id primarykey default:uuid_generate_v3() comment(默认主键)" swaggerignore:"true"`
	CreatedAt time.Time      `gorm:"created_at comment(创建时间)" swaggerignore:"true"`
	UpdatedAt time.Time      `gorm:"updated_at comment(更新时间)" swaggerignore:"true"`
	DeletedAt gorm.DeletedAt `gorm:"updated_at index comment(删除时间)" swaggerignore:"true"`
	Version   int            `gorm:"version comment(版本)" swaggerignore:"true"`
}

func (*BaseModel) BeforeCreate

func (model *BaseModel) BeforeCreate(tx *gorm.DB) (err error)

type File

type File struct {
	BaseModel  `xorm:"extends" json:"-" swaggerignore:"true"`
	RootHash   string `gorm:"column:root_hash;unique" json:"root_hash"` //跟索引
	KeyPath    string `gorm:"column:key_path"  json:"key_path"`         //秘钥
	KeyHash    string `gorm:"column:key_hash"  json:"key_hash"`         //秘钥
	ThumbPath  string `gorm:"column:thumb_path" json:"thumb_path"`      //缩略图地址
	ThumbHash  string `gorm:"column:thumb_hash" json:"thumb_hash"`      //缩略图Hash
	InfoPath   string `gorm:"column:info_path" json:"info_path"`        //媒体信息地址
	InfoHash   string `gorm:"column:info_hash" json:"info_hash"`        //媒体信息Hash
	PosterPath string `gorm:"column:poster_path" json:"poster_path"`    //海报地址
	PosterHash string `gorm:"column:poster_hash" json:"poster_hash"`    //海报Hash
	SourcePath string `gorm:"column:source_path" json:"source_path"`    //原片地址
	SourceHash string `gorm:"column:source_hash" json:"source_hash"`    //原片Hash
	M3U8Index  string `gorm:"column:m3u8_index" json:"m3u8_index"`      //M3U8名
	M3U8Path   string `gorm:"column:m3u8_path" json:"m3u8_path"`        //切片地址
	M3U8Hash   string `gorm:"column:m3u8_hash" json:"m3u8_hash"`        //切片Hash
}

type Info

type Info struct {
	BaseModel    `json:"-" swaggerignore:"true"`
	Title        string      `gorm:"column:title" json:"title"`                 //标题
	VideoNo      string      `gorm:"column:video_no" json:"video_no"`           //编号
	Intro        string      `gorm:"column:intro;size:2048" json:"intro"`       //简介
	Alias        StringArray `gorm:"column:alias" json:"alias"`                 //别名,片名
	Role         StringArray `gorm:"column:role" json:"role"`                   //主演
	Director     string      `gorm:"column:director" json:"director"`           //导演
	Systematics  string      `gorm:"column:systematics" json:"systematics"`     //分级
	Season       string      `gorm:"column:season" json:"season"`               //季
	TotalEpisode string      `gorm:"column:total_episode" json:"total_episode"` //总集数
	Episode      string      `gorm:"column:episode" json:"episode"`             //集数
	Producer     string      `gorm:"column:producer" json:"producer"`           //生产商
	Publisher    string      `gorm:"column:publisher" json:"publisher"`         //发行商
	MediaType    string      `gorm:"column:media_type" json:"media_type"`       //类型:film,FanDrama
	Format       string      `gorm:"column:format" json:"format"`               //输出格式:3D,2D,VR(VR格式:Half-SBS:左右半宽,Half-OU:上下半高,SBS:左右全宽)
	Language     string      `gorm:"column:language" json:"language"`           //语言
	Caption      string      `gorm:"column:caption" json:"caption"`             //字幕
	Group        string      `gorm:"column:group" json:"group"`                 //分组
	Index        string      `gorm:"column:index" json:"index"`                 //索引
	ReleaseDate  string      `gorm:"column:release_date" json:"release_date"`   //发行日期
	Sharpness    string      `gorm:"column:sharpness" json:"sharpness"`         //清晰度
	Series       string      `gorm:"column:series" json:"series"`               //系列
	Tags         StringArray `gorm:"column:tags" json:"tags"`                   //标签
	Length       string      `gorm:"column:length" json:"length"`               //时长
	Sample       StringArray `gorm:"column:sample" json:"sample"`               //样板图
	Uncensored   bool        `gorm:"column:uncensored" json:"uncensored"`       //有码,无码
}

type LinkInfo

type LinkInfo struct {
	Category string `gorm:"column:category" json:"category"` //类别
}

type Media

type Media struct {
	BaseModel  `json:"-" swaggerignore:"true"`
	InfoID     string `gorm:"type:uuid;index;foreignKey:Info" json:"-"`
	Info       Info   `json:"info"`
	LinkInfoID string `gorm:"type:uuid;index;foreignKey:LinkInfo" json:"-"`
	LinkInfo   Info   `json:"linkinfo"`
	FileID     string `gorm:"type:uuid;index;foreignKey:File" json:"-"`
	File       File   `json:"file"`
}

type Node

type Node struct {
	BaseModel `json:"-" swaggerignore:"true"`
}

type Paginator

type Paginator struct {
	CurrentPage  int         `json:"current_page"`
	LastPage     int         `json:"last_page"`
	PerPage      int         `json:"per_page"`
	Data         interface{} `json:"data"`
	Total        int64       `json:"total"`
	FirstPageURL string      `json:"first_page_url"`
	LastPageURL  string      `json:"last_page_url"`
	NextPageURL  string      `json:"next_page_url"`
	PrevPageURL  string      `json:"prev_page_url"`
	Path         string      `json:"path"`
	From         int         `json:"from"`
	To           int         `json:"to"`
}

func Page

func Page(r *http.Request, v interface{}) *Paginator

func (*Paginator) Find

func (p *Paginator) Find(db *gorm.DB) (*Paginator, error)

type StringArray

type StringArray []string

func (*StringArray) GormDataType

func (s *StringArray) GormDataType() string

func (*StringArray) Scan

func (s *StringArray) Scan(value interface{}) error

func (StringArray) Value

func (s StringArray) Value() (driver.Value, error)

实现 driver.Valuer 接口,Value 返回 json value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL