videostore

package
v0.0.0-...-9ff5dc0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: AGPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const SortDirectionAscending = "asc"
View Source
const SortDirectionDescending = "desc"
View Source
const SortFieldTimeCreated = "time_created"
View Source
const SortFieldTimeUpdated = "time_updated"
View Source
const SortFieldTitle = "title"

Variables

View Source
var ErrorVideoNotFound = errors.New("video not found")

Functions

func NewDummyVideoRepo

func NewDummyVideoRepo(fs files.FileSystem) *dummyVideoRepo

func NewPostgresVideoRepo

func NewPostgresVideoRepo(db pg.DB) *postgresVideoRepo

Types

type Video

type Video struct {
	ID               uint     `json:"id"`
	Title            string   `json:"title"`
	Description      string   `json:"description"`
	Thumbnail        string   `json:"thumbnail"`
	Source           string   `json:"source"`
	OriginalFileName string   `json:"original_file_name"`
	TimeCreated      string   `json:"time_created"`
	TimeUpdated      string   `json:"time_updated"`
	Tags             []string `json:"tags"`
}

func GenerateThumbnail

func GenerateThumbnail(video Video, repo VideoRepo, fs files.FileSystem) (Video, error)

func (Video) Exists

func (video Video) Exists() bool

type VideoFilter

type VideoFilter struct {
	Title string
	Tags  []string
	Any   string

	SortDirection string
	SortField     string
}

VideoFilter represents a "filter" used for querying stored videos. It's eventually shoved into the `WHERE` part of a query, or equivalent.

func (VideoFilter) Empty

func (filter VideoFilter) Empty() bool

func (VideoFilter) Sort

func (filter VideoFilter) Sort() bool

func (VideoFilter) ValidSortDirection

func (filter VideoFilter) ValidSortDirection() bool

func (VideoFilter) ValidSortField

func (filter VideoFilter) ValidSortField() bool

type VideoRepo

type VideoRepo interface {
	Save(video Video) (Video, error)
	FindById(id uint) (Video, error)
	All(filter VideoFilter, limit uint, offset uint) ([]Video, error)
	Count(filter VideoFilter) (uint, error)
	Delete(video Video) error
}

Jump to

Keyboard shortcuts

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