386 lines
14 KiB
Go
386 lines
14 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// source: queries.sql
|
|
|
|
package store
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const createMediaSet = `-- name: CreateMediaSet :one
|
|
INSERT INTO media_sets (youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_sample_rate, audio_content_length, audio_encoded_mime_type, video_youtube_itag, video_content_length, video_mime_type, video_duration_nanos, created_at, updated_at)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, NOW(), NOW())
|
|
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_bucket, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_bucket, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_bucket, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_bucket, audio_encoded_s3_key, audio_encoded_s3_uploaded_at
|
|
`
|
|
|
|
type CreateMediaSetParams struct {
|
|
YoutubeID string
|
|
AudioYoutubeItag int32
|
|
AudioChannels int32
|
|
AudioFramesApprox int64
|
|
AudioSampleRate int32
|
|
AudioContentLength int64
|
|
AudioEncodedMimeType string
|
|
VideoYoutubeItag int32
|
|
VideoContentLength int64
|
|
VideoMimeType string
|
|
VideoDurationNanos int64
|
|
}
|
|
|
|
func (q *Queries) CreateMediaSet(ctx context.Context, arg CreateMediaSetParams) (MediaSet, error) {
|
|
row := q.db.QueryRow(ctx, createMediaSet,
|
|
arg.YoutubeID,
|
|
arg.AudioYoutubeItag,
|
|
arg.AudioChannels,
|
|
arg.AudioFramesApprox,
|
|
arg.AudioSampleRate,
|
|
arg.AudioContentLength,
|
|
arg.AudioEncodedMimeType,
|
|
arg.VideoYoutubeItag,
|
|
arg.VideoContentLength,
|
|
arg.VideoMimeType,
|
|
arg.VideoDurationNanos,
|
|
)
|
|
var i MediaSet
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.YoutubeID,
|
|
&i.AudioYoutubeItag,
|
|
&i.AudioChannels,
|
|
&i.AudioFramesApprox,
|
|
&i.AudioFrames,
|
|
&i.AudioSampleRate,
|
|
&i.AudioRawS3Bucket,
|
|
&i.AudioRawS3Key,
|
|
&i.AudioRawS3UploadedAt,
|
|
&i.AudioEncodedMimeType,
|
|
&i.VideoYoutubeItag,
|
|
&i.VideoS3Bucket,
|
|
&i.VideoS3Key,
|
|
&i.VideoS3UploadedAt,
|
|
&i.VideoMimeType,
|
|
&i.VideoDurationNanos,
|
|
&i.VideoThumbnailS3Bucket,
|
|
&i.VideoThumbnailS3Key,
|
|
&i.VideoThumbnailS3UploadedAt,
|
|
&i.VideoThumbnailMimeType,
|
|
&i.VideoThumbnailWidth,
|
|
&i.VideoThumbnailHeight,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.AudioContentLength,
|
|
&i.VideoContentLength,
|
|
&i.AudioEncodedS3Bucket,
|
|
&i.AudioEncodedS3Key,
|
|
&i.AudioEncodedS3UploadedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getMediaSet = `-- name: GetMediaSet :one
|
|
SELECT id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_bucket, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_bucket, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_bucket, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_bucket, audio_encoded_s3_key, audio_encoded_s3_uploaded_at FROM media_sets WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) GetMediaSet(ctx context.Context, id uuid.UUID) (MediaSet, error) {
|
|
row := q.db.QueryRow(ctx, getMediaSet, id)
|
|
var i MediaSet
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.YoutubeID,
|
|
&i.AudioYoutubeItag,
|
|
&i.AudioChannels,
|
|
&i.AudioFramesApprox,
|
|
&i.AudioFrames,
|
|
&i.AudioSampleRate,
|
|
&i.AudioRawS3Bucket,
|
|
&i.AudioRawS3Key,
|
|
&i.AudioRawS3UploadedAt,
|
|
&i.AudioEncodedMimeType,
|
|
&i.VideoYoutubeItag,
|
|
&i.VideoS3Bucket,
|
|
&i.VideoS3Key,
|
|
&i.VideoS3UploadedAt,
|
|
&i.VideoMimeType,
|
|
&i.VideoDurationNanos,
|
|
&i.VideoThumbnailS3Bucket,
|
|
&i.VideoThumbnailS3Key,
|
|
&i.VideoThumbnailS3UploadedAt,
|
|
&i.VideoThumbnailMimeType,
|
|
&i.VideoThumbnailWidth,
|
|
&i.VideoThumbnailHeight,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.AudioContentLength,
|
|
&i.VideoContentLength,
|
|
&i.AudioEncodedS3Bucket,
|
|
&i.AudioEncodedS3Key,
|
|
&i.AudioEncodedS3UploadedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getMediaSetByYoutubeID = `-- name: GetMediaSetByYoutubeID :one
|
|
SELECT id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_bucket, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_bucket, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_bucket, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_bucket, audio_encoded_s3_key, audio_encoded_s3_uploaded_at FROM media_sets WHERE youtube_id = $1
|
|
`
|
|
|
|
func (q *Queries) GetMediaSetByYoutubeID(ctx context.Context, youtubeID string) (MediaSet, error) {
|
|
row := q.db.QueryRow(ctx, getMediaSetByYoutubeID, youtubeID)
|
|
var i MediaSet
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.YoutubeID,
|
|
&i.AudioYoutubeItag,
|
|
&i.AudioChannels,
|
|
&i.AudioFramesApprox,
|
|
&i.AudioFrames,
|
|
&i.AudioSampleRate,
|
|
&i.AudioRawS3Bucket,
|
|
&i.AudioRawS3Key,
|
|
&i.AudioRawS3UploadedAt,
|
|
&i.AudioEncodedMimeType,
|
|
&i.VideoYoutubeItag,
|
|
&i.VideoS3Bucket,
|
|
&i.VideoS3Key,
|
|
&i.VideoS3UploadedAt,
|
|
&i.VideoMimeType,
|
|
&i.VideoDurationNanos,
|
|
&i.VideoThumbnailS3Bucket,
|
|
&i.VideoThumbnailS3Key,
|
|
&i.VideoThumbnailS3UploadedAt,
|
|
&i.VideoThumbnailMimeType,
|
|
&i.VideoThumbnailWidth,
|
|
&i.VideoThumbnailHeight,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.AudioContentLength,
|
|
&i.VideoContentLength,
|
|
&i.AudioEncodedS3Bucket,
|
|
&i.AudioEncodedS3Key,
|
|
&i.AudioEncodedS3UploadedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const setEncodedAudioUploaded = `-- name: SetEncodedAudioUploaded :one
|
|
UPDATE media_sets
|
|
SET audio_encoded_s3_bucket = $2, audio_encoded_s3_key = $3, audio_encoded_s3_uploaded_at = NOW(), updated_at = NOW()
|
|
WHERE id = $1
|
|
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_bucket, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_bucket, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_bucket, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_bucket, audio_encoded_s3_key, audio_encoded_s3_uploaded_at
|
|
`
|
|
|
|
type SetEncodedAudioUploadedParams struct {
|
|
ID uuid.UUID
|
|
AudioEncodedS3Bucket sql.NullString
|
|
AudioEncodedS3Key sql.NullString
|
|
}
|
|
|
|
func (q *Queries) SetEncodedAudioUploaded(ctx context.Context, arg SetEncodedAudioUploadedParams) (MediaSet, error) {
|
|
row := q.db.QueryRow(ctx, setEncodedAudioUploaded, arg.ID, arg.AudioEncodedS3Bucket, arg.AudioEncodedS3Key)
|
|
var i MediaSet
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.YoutubeID,
|
|
&i.AudioYoutubeItag,
|
|
&i.AudioChannels,
|
|
&i.AudioFramesApprox,
|
|
&i.AudioFrames,
|
|
&i.AudioSampleRate,
|
|
&i.AudioRawS3Bucket,
|
|
&i.AudioRawS3Key,
|
|
&i.AudioRawS3UploadedAt,
|
|
&i.AudioEncodedMimeType,
|
|
&i.VideoYoutubeItag,
|
|
&i.VideoS3Bucket,
|
|
&i.VideoS3Key,
|
|
&i.VideoS3UploadedAt,
|
|
&i.VideoMimeType,
|
|
&i.VideoDurationNanos,
|
|
&i.VideoThumbnailS3Bucket,
|
|
&i.VideoThumbnailS3Key,
|
|
&i.VideoThumbnailS3UploadedAt,
|
|
&i.VideoThumbnailMimeType,
|
|
&i.VideoThumbnailWidth,
|
|
&i.VideoThumbnailHeight,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.AudioContentLength,
|
|
&i.VideoContentLength,
|
|
&i.AudioEncodedS3Bucket,
|
|
&i.AudioEncodedS3Key,
|
|
&i.AudioEncodedS3UploadedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const setRawAudioUploaded = `-- name: SetRawAudioUploaded :one
|
|
UPDATE media_sets
|
|
SET audio_raw_s3_bucket = $2, audio_raw_s3_key = $3, audio_frames = $4, audio_raw_s3_uploaded_at = NOW(), updated_at = NOW()
|
|
WHERE id = $1
|
|
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_bucket, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_bucket, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_bucket, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_bucket, audio_encoded_s3_key, audio_encoded_s3_uploaded_at
|
|
`
|
|
|
|
type SetRawAudioUploadedParams struct {
|
|
ID uuid.UUID
|
|
AudioRawS3Bucket sql.NullString
|
|
AudioRawS3Key sql.NullString
|
|
AudioFrames sql.NullInt64
|
|
}
|
|
|
|
func (q *Queries) SetRawAudioUploaded(ctx context.Context, arg SetRawAudioUploadedParams) (MediaSet, error) {
|
|
row := q.db.QueryRow(ctx, setRawAudioUploaded,
|
|
arg.ID,
|
|
arg.AudioRawS3Bucket,
|
|
arg.AudioRawS3Key,
|
|
arg.AudioFrames,
|
|
)
|
|
var i MediaSet
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.YoutubeID,
|
|
&i.AudioYoutubeItag,
|
|
&i.AudioChannels,
|
|
&i.AudioFramesApprox,
|
|
&i.AudioFrames,
|
|
&i.AudioSampleRate,
|
|
&i.AudioRawS3Bucket,
|
|
&i.AudioRawS3Key,
|
|
&i.AudioRawS3UploadedAt,
|
|
&i.AudioEncodedMimeType,
|
|
&i.VideoYoutubeItag,
|
|
&i.VideoS3Bucket,
|
|
&i.VideoS3Key,
|
|
&i.VideoS3UploadedAt,
|
|
&i.VideoMimeType,
|
|
&i.VideoDurationNanos,
|
|
&i.VideoThumbnailS3Bucket,
|
|
&i.VideoThumbnailS3Key,
|
|
&i.VideoThumbnailS3UploadedAt,
|
|
&i.VideoThumbnailMimeType,
|
|
&i.VideoThumbnailWidth,
|
|
&i.VideoThumbnailHeight,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.AudioContentLength,
|
|
&i.VideoContentLength,
|
|
&i.AudioEncodedS3Bucket,
|
|
&i.AudioEncodedS3Key,
|
|
&i.AudioEncodedS3UploadedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const setVideoThumbnailUploaded = `-- name: SetVideoThumbnailUploaded :one
|
|
UPDATE media_sets
|
|
SET video_thumbnail_width = $2, video_thumbnail_height = $3, video_thumbnail_mime_type = $4, video_thumbnail_s3_bucket = $5, video_thumbnail_s3_key = $6, video_thumbnail_s3_uploaded_at = NOW(), updated_at = NOW()
|
|
WHERE id = $1
|
|
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_bucket, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_bucket, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_bucket, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_bucket, audio_encoded_s3_key, audio_encoded_s3_uploaded_at
|
|
`
|
|
|
|
type SetVideoThumbnailUploadedParams struct {
|
|
ID uuid.UUID
|
|
VideoThumbnailWidth sql.NullInt32
|
|
VideoThumbnailHeight sql.NullInt32
|
|
VideoThumbnailMimeType sql.NullString
|
|
VideoThumbnailS3Bucket sql.NullString
|
|
VideoThumbnailS3Key sql.NullString
|
|
}
|
|
|
|
func (q *Queries) SetVideoThumbnailUploaded(ctx context.Context, arg SetVideoThumbnailUploadedParams) (MediaSet, error) {
|
|
row := q.db.QueryRow(ctx, setVideoThumbnailUploaded,
|
|
arg.ID,
|
|
arg.VideoThumbnailWidth,
|
|
arg.VideoThumbnailHeight,
|
|
arg.VideoThumbnailMimeType,
|
|
arg.VideoThumbnailS3Bucket,
|
|
arg.VideoThumbnailS3Key,
|
|
)
|
|
var i MediaSet
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.YoutubeID,
|
|
&i.AudioYoutubeItag,
|
|
&i.AudioChannels,
|
|
&i.AudioFramesApprox,
|
|
&i.AudioFrames,
|
|
&i.AudioSampleRate,
|
|
&i.AudioRawS3Bucket,
|
|
&i.AudioRawS3Key,
|
|
&i.AudioRawS3UploadedAt,
|
|
&i.AudioEncodedMimeType,
|
|
&i.VideoYoutubeItag,
|
|
&i.VideoS3Bucket,
|
|
&i.VideoS3Key,
|
|
&i.VideoS3UploadedAt,
|
|
&i.VideoMimeType,
|
|
&i.VideoDurationNanos,
|
|
&i.VideoThumbnailS3Bucket,
|
|
&i.VideoThumbnailS3Key,
|
|
&i.VideoThumbnailS3UploadedAt,
|
|
&i.VideoThumbnailMimeType,
|
|
&i.VideoThumbnailWidth,
|
|
&i.VideoThumbnailHeight,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.AudioContentLength,
|
|
&i.VideoContentLength,
|
|
&i.AudioEncodedS3Bucket,
|
|
&i.AudioEncodedS3Key,
|
|
&i.AudioEncodedS3UploadedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const setVideoUploaded = `-- name: SetVideoUploaded :one
|
|
UPDATE media_sets
|
|
SET video_s3_bucket = $2, video_s3_key = $3, video_s3_uploaded_at = NOW(), updated_at = NOW()
|
|
WHERE id = $1
|
|
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_bucket, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_bucket, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, video_thumbnail_s3_bucket, video_thumbnail_s3_key, video_thumbnail_s3_uploaded_at, video_thumbnail_mime_type, video_thumbnail_width, video_thumbnail_height, created_at, updated_at, audio_content_length, video_content_length, audio_encoded_s3_bucket, audio_encoded_s3_key, audio_encoded_s3_uploaded_at
|
|
`
|
|
|
|
type SetVideoUploadedParams struct {
|
|
ID uuid.UUID
|
|
VideoS3Bucket sql.NullString
|
|
VideoS3Key sql.NullString
|
|
}
|
|
|
|
func (q *Queries) SetVideoUploaded(ctx context.Context, arg SetVideoUploadedParams) (MediaSet, error) {
|
|
row := q.db.QueryRow(ctx, setVideoUploaded, arg.ID, arg.VideoS3Bucket, arg.VideoS3Key)
|
|
var i MediaSet
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.YoutubeID,
|
|
&i.AudioYoutubeItag,
|
|
&i.AudioChannels,
|
|
&i.AudioFramesApprox,
|
|
&i.AudioFrames,
|
|
&i.AudioSampleRate,
|
|
&i.AudioRawS3Bucket,
|
|
&i.AudioRawS3Key,
|
|
&i.AudioRawS3UploadedAt,
|
|
&i.AudioEncodedMimeType,
|
|
&i.VideoYoutubeItag,
|
|
&i.VideoS3Bucket,
|
|
&i.VideoS3Key,
|
|
&i.VideoS3UploadedAt,
|
|
&i.VideoMimeType,
|
|
&i.VideoDurationNanos,
|
|
&i.VideoThumbnailS3Bucket,
|
|
&i.VideoThumbnailS3Key,
|
|
&i.VideoThumbnailS3UploadedAt,
|
|
&i.VideoThumbnailMimeType,
|
|
&i.VideoThumbnailWidth,
|
|
&i.VideoThumbnailHeight,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.AudioContentLength,
|
|
&i.VideoContentLength,
|
|
&i.AudioEncodedS3Bucket,
|
|
&i.AudioEncodedS3Key,
|
|
&i.AudioEncodedS3UploadedAt,
|
|
)
|
|
return i, err
|
|
}
|