local

package
v0.0.0-...-bded214 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(db *gorm.DB) error

Types

type Backup

type Backup struct {
	// contains filtered or unexported fields
}

func NewBackup

func NewBackup(downloader *Downloader, client *coubs.Client, db *gorm.DB, state *SharedState) *Backup

func (*Backup) Likes

func (b *Backup) Likes(profile string) error

func (*Backup) Profile

func (b *Backup) Profile(profile string) error

type Downloader

type Downloader struct {
	// contains filtered or unexported fields
}

func NewDownloader

func NewDownloader(client *coubs.Client, s3cli *s3.S3, db *gorm.DB, cfg *conf.App) *Downloader

func (*Downloader) DownloadCoub

func (d *Downloader) DownloadCoub(rawCoub []byte) error

type LikedCoub

type LikedCoub struct {
	gorm.Model
	Profile string `gorm:"not null;index:idx_liked_coub,unique"`
	CoubID  int    `gorm:"not null;index:idx_liked_coub,unique"`
	Info    []byte `gorm:"type:jsonb;not null"`
}

type ProfileCoub

type ProfileCoub struct {
	gorm.Model
	Profile     string    `gorm:"not null;index:idx_prof_coub,unique"`
	CoubID      int       `gorm:"not null;index:idx_prof_coub,unique"`
	PublishedAt time.Time `gorm:"not null"`
	Info        []byte    `gorm:"type:jsonb;not null"`
}

type SavedCoub

type SavedCoub struct {
	CoubID    int `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	Info      []byte `gorm:"type:jsonb;not null"`
	NoAudio   bool   `gorm:"not null"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(sss *s3.S3, db *gorm.DB, cfg *conf.App, state *SharedState) *Server

func (*Server) Router

func (s *Server) Router() *chi.Mux

type SharedState

type SharedState struct {
	State
	// contains filtered or unexported fields
}

func NewSharedState

func NewSharedState() *SharedState

func (*SharedState) DownloadingCoub

func (s *SharedState) DownloadingCoub(profile string, page, index int, rawCoub json.RawMessage)

func (*SharedState) DownloadingProfilePage

func (s *SharedState) DownloadingProfilePage(profile string, page int)

func (*SharedState) Get

func (s *SharedState) Get() State

func (*SharedState) GotProfilePage

func (s *SharedState) GotProfilePage(profile string, page int, response *coubs.PageResponse)

type State

type State struct {
	Profile    string
	Page       int
	PerPage    int
	TotalPages int

	IndexInPage   int
	Favorite      bool                `json:"favorite"`
	Recoub        bool                `json:"recoub"`
	Like          bool                `json:"like"`
	Dislike       bool                `json:"dislike"`
	ID            int                 `json:"id"`
	Type          string              `json:"type"`
	Permalink     string              `json:"permalink"`
	Title         string              `json:"title"`
	ViewsCount    int                 `json:"views_count"`
	PublishedAt   time.Time           `json:"published_at"`
	FileVersions  coubs.FileVersions  `json:"file_versions"`
	AudioVersions coubs.AudioVersions `json:"audio_versions,omitempty"`
	Channel       string              `json:"channel"`
	LikesCount    int                 `json:"likes_count"`
	DislikesCount int                 `json:"dislikes_count"`
}

Jump to

Keyboard shortcuts

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