store

package
v0.0.0-...-ed0d4f4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound  = errors.New("resource not found")
	ErrConflict  = errors.New("resource already exists")
	QueryTimeout = time.Second * 5
)

Functions

This section is empty.

Types

type Storage

type Storage struct {
	Videos VideoRepository
}

type Video

type Video struct {
	ID          int64     `json:"id"`
	Url         string    `json:"url"`
	Title       string    `json:"title"`
	UserID      int64     `json:"user_id"`
	Tags        []string  `json:"tags"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
}

type VideoRepository

type VideoRepository interface {
	SaveVideo(context.Context, *Video) error
	GetVideoById(context.Context, int64) error
	Update(context.Context, *Video) error
}

type VideoStore

type VideoStore struct {
	DB *pgxpool.Pool
}

func (*VideoStore) GetVideoById

func (v *VideoStore) GetVideoById(ctx context.Context, videoID int64) (*Video, error)

func (*VideoStore) SaveVideo

func (v *VideoStore) SaveVideo(ctx context.Context, video *Video) error

Jump to

Keyboard shortcuts

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