model

package
v0.0.0-...-182149f Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *config.Config) (db *gorm.DB, err error)

Types

type Actor

type Actor struct {
	ID          string `gorm:"type:uuid;primary_key"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`
	Name        string
	Videos      []Video `gorm:"many2many:video_actors;"`
	Thumbnail   bool
	Sex         string `gorm:"size:2;"`
	Aliases     []ActorAlias
	Links       []ActorLink
	Categories  []CategorySub `gorm:"many2many:actor_categories;"`
	Description string
}

func (*Actor) AliasesAsNiceString

func (a *Actor) AliasesAsNiceString() string

func (*Actor) BeforeCreate

func (a *Actor) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

func (*Actor) SexTypeAsString

func (a *Actor) SexTypeAsString() string

func (*Actor) URLAdmDelete

func (a *Actor) URLAdmDelete() string

func (*Actor) URLAdmEdit

func (a *Actor) URLAdmEdit() string

func (*Actor) URLThumb

func (a *Actor) URLThumb() string

func (*Actor) URLView

func (a *Actor) URLView() string

URLs

type ActorAlias

type ActorAlias struct {
	ID        string `gorm:"type:uuid;primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	Name      string
	ActorID   string
	Actor     Actor
}

func (*ActorAlias) BeforeCreate

func (a *ActorAlias) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

type ActorLink struct {
	ID        string `gorm:"type:uuid;primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	Provider  string
	ActorID   string
	Actor     Actor
	URL       string
}

func (*ActorLink) BeforeCreate

func (a *ActorLink) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

type Category

type Category struct {
	ID        string `gorm:"type:uuid;primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	Name      string
	Priority  int
	Sub       []CategorySub `gorm:"foreignKey:Category;references:ID"`
}

func (*Category) BeforeCreate

func (c *Category) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

type CategorySub

type CategorySub struct {
	ID        string `gorm:"type:uuid;primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	Name      string
	Category  string `gorm:"type:uuid"`
	Thumbnail bool
	Videos    []*Video `gorm:"many2many:video_categories;"`
	Actors    []*Actor `gorm:"many2many:actor_categories;"`
}

func (*CategorySub) BeforeCreate

func (c *CategorySub) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

func (*CategorySub) URLThumb

func (c *CategorySub) URLThumb() string

type Channel

type Channel struct {
	ID        string `gorm:"type:uuid;primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	Name      string
	Thumbnail bool
}

func (*Channel) BeforeCreate

func (c *Channel) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

func (*Channel) URLAdmEdit

func (c *Channel) URLAdmEdit() string

func (*Channel) URLThumb

func (c *Channel) URLThumb() string

func (*Channel) URLView

func (c *Channel) URLView() string

type Configuration

type Configuration struct {
	ID                 int `gorm:"type:primary_key"`
	UserAuthentication bool
	OfflineMode        bool `gorm:"default:false"`
}

type Provider

type Provider struct {
	ID                  string `gorm:"type:string;primary_key"`
	CreatedAt           time.Time
	UpdatedAt           time.Time
	DeletedAt           gorm.DeletedAt `gorm:"index"`
	NiceName            string
	Enabled             bool `gorm:"default:true"`
	AbleToSearchActor   bool `gorm:"default:false"`
	AbleToScrapePicture bool `gorm:"default:false"`
}

type Task

type Task struct {
	ID         string `gorm:"type:uuid;primary_key"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  gorm.DeletedAt `gorm:"index"`
	DoneAt     *time.Time     `gorm:"index"`
	Name       string
	Step       string
	Status     TaskStatus        `gorm:"default:todo"`
	Parameters map[string]string `gorm:"serializer:json"`
}

func (*Task) BeforeCreate

func (t *Task) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

type TaskStatus

type TaskStatus string
const (
	TaskStatusTodo       TaskStatus = "todo"
	TaskStatusInProgress TaskStatus = "in-progress"
	TaskStatusDone       TaskStatus = "done"
	TaskStatusError      TaskStatus = "error"
)

type User

type User struct {
	ID        string `gorm:"type:uuid;primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
	Username  string
	Password  string
	Admin     bool
	Session   UserSession
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

func (*User) URLAdmDelete

func (u *User) URLAdmDelete() string

type UserSession

type UserSession struct {
	ID         string `gorm:"type:uuid;primary_key"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	UserID     *string
	ValidUntil time.Time
}

func (*UserSession) BeforeCreate

func (u *UserSession) BeforeCreate(tx *gorm.DB) error

UUID pre-hook

type Video

type Video struct {
	ID            string `gorm:"type:uuid;primary_key"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
	DeletedAt     gorm.DeletedAt `gorm:"index"`
	Name          string
	Filename      string
	Actors        []Actor `gorm:"many2many:video_actors;"`
	Channel       *Channel
	ChannelID     *string
	Thumbnail     bool
	ThumbnailMini bool
	Duration      time.Duration
	Type          string        `gorm:"size:1;"`
	Imported      bool          `gorm:"default:false"`
	Status        VideoStatus   `gorm:"default:creating"`
	Categories    []CategorySub `gorm:"many2many:video_categories;"`
}

Video model defines the generic video type used for videos, clips and movies

func (*Video) BeforeCreate

func (v *Video) BeforeCreate(tx *gorm.DB) error

func (*Video) FolderRelativePath

func (v *Video) FolderRelativePath() string

func (*Video) HasDuration

func (v *Video) HasDuration() bool

func (*Video) NiceDuration

func (v *Video) NiceDuration() string

func (*Video) NiceDurationShort

func (v *Video) NiceDurationShort() string

func (*Video) RelativePath

func (v *Video) RelativePath() string

func (*Video) String

func (v *Video) String() string

func (*Video) ThumbnailRelativePath

func (v *Video) ThumbnailRelativePath() string

func (*Video) ThumbnailXSRelativePath

func (v *Video) ThumbnailXSRelativePath() string

func (*Video) TypeAsString

func (v *Video) TypeAsString() string

func (*Video) URLAdmEdit

func (v *Video) URLAdmEdit() string

func (*Video) URLStream

func (v *Video) URLStream() string

func (*Video) URLThumb

func (v *Video) URLThumb() string

func (*Video) URLThumbXS

func (v *Video) URLThumbXS() string

func (*Video) URLView

func (v *Video) URLView() string

type VideoStatus

type VideoStatus string
const (
	VideoStatusCreating VideoStatus = "creating"
	VideoStatusReady    VideoStatus = "ready"
	VideoStatusDeleting VideoStatus = "deleting"
)

type VideoView

type VideoView struct {
	VideoID string `gorm:"primaryKey"`
	Video   Video
	UserID  string `gorm:"primaryKey"`
	User    User
	Count   int
}

Jump to

Keyboard shortcuts

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