func (c *Connection) SelectOneRandomVideo(ctx context.Context, videoPlaylist string) (*YoutubeVideo, error) {
	var video YoutubeVideo
	// not sent in the last 3 months
	rows, err := c.DB.QueryxContext(ctx, `SELECT
	twitter_username,
	video_title,
	video_url,
	video_playlist,
	conference_year,
	presenter_twitter_username
	FROM yt_videos WHERE video_playlist = $1 ORDER BY random() LIMIT 1`, videoPlaylist)
	if err != nil {
		return &video, fmt.Errorf("err: %w", err)
	}
	defer rows.Close()
	for rows.Next() {
		err = rows.StructScan(&video)
		if err != nil {
			return &video, fmt.Errorf("rows.ScanStruct: %w", err)
		}
	}
	if rows.Err() != nil {
		return &video, fmt.Errorf("rows.Err: %w", rows.Err())
	}

	return &video, nil
}
// SelectOneRandomVideo selects a random video from the database.
// TODO: filter out videos that have been sent recently.
SelectOneRandomVideo selects a random video from the database.
TODO: filter out videos that have been sent recently.
// SelectOneRandomVideo selects a random video from the database . // TODO : filter out videos that have been sent recently .
func (c *Connection) SelectOneRandomVideo(ctx context.Context, videoPlaylist string) (*YoutubeVideo, error) {
	var video YoutubeVideo
	rows, err := c.DB.QueryxContext(ctx, `SELECT
	twitter_username,
	video_title,
	video_url,
	video_playlist,
	conference_year,
	presenter_twitter_username
	FROM yt_videos WHERE video_playlist = $1 ORDER BY random() LIMIT 1`, videoPlaylist)
	if err != nil {
		return &video, fmt.Errorf("err: %w", err)
	}
	defer rows.Close()
	for rows.Next() {
		err = rows.StructScan(&video)
		if err != nil {
			return &video, fmt.Errorf("rows.ScanStruct: %w", err)
		}
	}
	if rows.Err() != nil {
		return &video, fmt.Errorf("rows.Err: %w", rows.Err())
	}
	return &video, nil
}
func ( c * Connection ) SelectOneRandomVideo ( ctx context . Context , videoPlaylist string ) ( * YoutubeVideo , error ) { var video YoutubeVideo rows , err := c . DB . QueryxContext ( ctx , `SELECT
	twitter_username,
	video_title,
	video_url,
	video_playlist,
	conference_year,
	presenter_twitter_username
	FROM yt_videos WHERE video_playlist = $1 ORDER BY random() LIMIT 1` , videoPlaylist ) if err != nil { return & video , fmt . Errorf ( " " , err ) } defer rows . Close ( ) for rows . Next ( ) { err = rows . StructScan ( & video ) if err != nil { return & video , fmt . Errorf ( " " , err ) } } if rows . Err ( ) != nil { return & video , fmt . Errorf ( " " , rows . Err ( ) ) } return & video , nil }
SelectOneRandomVideo selects a random video from the database.
SelectOneRandomVideo selects a random video from the database .
// not sent in the last 3 months