db

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Global database instance
	DB *sql.DB
)

Functions

func CloseDB

func CloseDB() error

CloseDB closes the database connection

func GetDB

func GetDB() (*sql.DB, error)

GetDB returns the global database instance, initializing it if necessary

func GetDatabasePath

func GetDatabasePath() (string, error)

GetDatabasePath returns the path where the database is stored

func GetSetting

func GetSetting(key string) (string, error)

GetSetting retrieves a setting value by key

func LogDebug

func LogDebug(message string, args ...interface{})

LogDebug prints debug messages when in development mode

func SetSetting

func SetSetting(key, value string) error

SetSetting updates or inserts a setting

func StoreChannel

func StoreChannel(channel Channel) error

StoreChannel stores a channel in the database

func StoreVideos

func StoreVideos(channelID string, videos []Video) error

StoreVideos stores multiple videos in the database

func UpdateVideoFileSize

func UpdateVideoFileSize(videoID string, fileSize int64) error

UpdateVideoFileSize updates the file_size for a video in the database

Types

type Channel

type Channel struct {
	ID              string    `json:"_id"`
	Title           string    `json:"title"`
	Summary         string    `json:"summary,omitempty"`
	TextInfo        string    `json:"textInfo,omitempty"`
	Avatar          string    `json:"avatar,omitempty"`
	CoverImage      string    `json:"coverImage,omitempty"`
	IsLive          bool      `json:"isLive,omitempty"`
	TotalVideos     float64   `json:"totalVideos,omitempty"`
	TotalVideoViews float64   `json:"totalVideoViews,omitempty"`
	TotalLikes      float64   `json:"totalLikes,omitempty"`
	Videos          []Video   `json:"videos,omitempty"`
	ShowInfo        *ShowInfo `json:"showInfo,omitempty"`
	Links           *Links    `json:"links,omitempty"`
}

Channel represents a channel structure

func GetAllChannels

func GetAllChannels() ([]Channel, error)

GetAllChannels retrieves all channels from the database

type Links struct {
	Website       string `json:"website"`
	Facebook      string `json:"facebook"`
	Twitter       string `json:"twitter"`
	Gab           string `json:"gab"`
	Minds         string `json:"minds"`
	Telegram      string `json:"telegram"`
	SubscribeStar string `json:"subscribeStar"`
}

type ShowInfo

type ShowInfo struct {
	Times string `json:"times"`
	Phone string `json:"phone"`
}

type Video

type Video struct {
	ID            string  `json:"_id"`
	Title         string  `json:"title"`
	Summary       string  `json:"summary"`
	LargeImage    string  `json:"largeImage"`
	VideoDuration float64 `json:"videoDuration"`
	CreatedAt     string  `json:"createdAt"`
	DirectURL     string  `json:"directUrl"`
	PlayCount     int     `json:"playCount,omitempty"`
	LikeCount     int     `json:"likeCount,omitempty"`
	AngerCount    int     `json:"angerCount,omitempty"`
	EmbedURL      string  `json:"embedUrl,omitempty"`
	Published     bool    `json:"published,omitempty"`
	FileSize      int64   `json:"fileSize,omitempty"`
}

Video represents a video structure

func GetChannelVideos

func GetChannelVideos(channelID string, limit, offset int) ([]Video, error)

GetChannelVideos retrieves videos for a specific channel from the database

Jump to

Keyboard shortcuts

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