store

package
v0.0.0-...-7df91eb Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const NoCategory = "No category"
View Source
const Pending = "Pending"

Variables

View Source
var (
	HOST        = os.Getenv("POSTGRES_HOST")
	USER        = os.Getenv("POSTGRES_USER")
	DB_NAME     = os.Getenv("POSTGRES_DB")
	DB_PASSWORD = os.Getenv("POSTGRES_PASSWORD")
)

Functions

This section is empty.

Types

type Category

type Category struct {
	Category          string `json:"category,omitempty" gorm:"primaryKey"`
	ConcurrentViewers uint64 `json:"concurrentViewers,omitempty,string"`
	Url               string `json:"url,omitempty"`
}

type ListOption

type ListOption interface {
	Apply(*listSettings)
}

func WithFilters

func WithFilters(filters []string) ListOption

Filters

func WithGaming

func WithGaming(gaming bool) ListOption

Gaming

func WithLive

func WithLive(live bool) ListOption

Live

func WithMaxResults

func WithMaxResults(maxResults int) ListOption

MaxResults

func WithOffset

func WithOffset(offset int) ListOption

Offset

type PGStore

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

func NewPGStore

func NewPGStore() PGStore

func (*PGStore) Add

func (ps *PGStore) Add(video Stream)

func (*PGStore) Categories

func (ps *PGStore) Categories(gaming bool) []Category

func (*PGStore) Delete

func (ps *PGStore) Delete(Id string)

func (*PGStore) FindOne

func (ps *PGStore) FindOne(Id string) Stream

func (*PGStore) Len

func (ps *PGStore) Len() int

func (*PGStore) List

func (ps *PGStore) List(opts ...ListOption) []Stream

func (*PGStore) SaveCategory

func (ps *PGStore) SaveCategory(category Category)

func (*PGStore) Update

func (ps *PGStore) Update(video Stream)

type Store

type Store interface {
	FindOne(Id string) Stream
	Add(video Stream)
	Delete(Id string)
	Update(video Stream)
	List(...ListOption) []Stream
	Categories(bool) []Category
	Len() int
	SaveCategory(category Category)
}

type Stream

type Stream struct {
	// Id: The ID that YouTube uses to uniquely identify the video.
	Id string `json:"id,omitempty" gorm:"primaryKey"`

	// ActualStartTime: The time that the broadcast actually started. This
	// value will not be available until the broadcast begins.
	ActualStartTime string `json:"actualStartTime,omitempty"`

	// ConcurrentViewers: The number of viewers currently watching the
	// broadcast. The property and its value will be present if the
	// broadcast has current viewers and the broadcast owner has not hidden
	// the viewcount for the video. Note that YouTube stops tracking the
	// number of concurrent viewers for a broadcast when the broadcast ends.
	// So, this property would not identify the number of viewers watching
	// an archived video of a live broadcast that already ended.
	ConcurrentViewers uint64 `json:"concurrentViewers,omitempty,string"`

	// CategoryId: The YouTube video category associated with the video.
	CategoryId string `json:"categoryId,omitempty"`

	// ChannelId: The ID that YouTube uses to uniquely identify the channel
	// that the video was uploaded to.
	ChannelId string `json:"channelId,omitempty"`

	// ChannelTitle: Channel title for the channel that the video belongs
	// to.
	ChannelTitle string `json:"channelTitle,omitempty"`

	// DefaultAudioLanguage: The default_audio_language property specifies
	// the language spoken in the video's default audio track.
	DefaultAudioLanguage string `json:"defaultAudioLanguage,omitempty"`

	// DefaultLanguage: The language of the videos's default snippet.
	DefaultLanguage string `json:"defaultLanguage,omitempty"`

	// Description: The video's description. @mutable youtube.videos.insert
	// youtube.videos.update
	Description string `json:"description,omitempty"`

	// LiveBroadcastContent: Indicates if the video is an upcoming/active
	// live broadcast. Or it's "none" if the video is not an upcoming/active
	// live broadcast.
	//
	// Possible values:
	//   "none"
	//   "upcoming" - The live broadcast is upcoming.
	//   "live" - The live broadcast is active.
	//   "completed" - The live broadcast has been completed.
	LiveBroadcastContent string `json:"liveBroadcastContent,omitempty"`

	// PublishedAt: The date and time when the video was uploaded.
	PublishedAt string `json:"publishedAt,omitempty"`

	// Tags: A list of keyword tags associated with the video. Tags may
	// contain spaces.
	Tags pq.StringArray `json:"tags,omitempty" gorm:"type:text[]"`

	// Thumbnails: A map of thumbnail images associated with the video. For
	// each object in the map, the key is the name of the thumbnail image,
	// and the value is an object that contains other information about the
	// thumbnail.
	Thumbnail string `json:"thumbnail,omitempty"`

	// Title: The video's title. @mutable youtube.videos.insert
	// youtube.videos.update
	Title string `json:"title,omitempty"`

	// The category of the stream
	Category string `json:"category,omitempty"`
}

func StreamData

func StreamData(video youtube.Video) Stream

Jump to

Keyboard shortcuts

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