clipper/backend/generated/store/queries.sql.go

375 lines
13 KiB
Go
Raw Permalink Normal View History

2021-12-05 10:53:33 +00:00
// 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, title, description, author, 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, $12, $13, $14, NOW(), NOW())
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, 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_key, audio_encoded_s3_uploaded_at, title, description, author
2021-12-05 10:53:33 +00:00
`
type CreateMediaSetParams struct {
YoutubeID string
Title string
Description string
Author string
2021-12-05 10:53:33 +00:00
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.Title,
arg.Description,
arg.Author,
2021-12-05 10:53:33 +00:00
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.AudioRawS3Key,
&i.AudioRawS3UploadedAt,
&i.AudioEncodedMimeType,
&i.VideoYoutubeItag,
&i.VideoS3Key,
&i.VideoS3UploadedAt,
&i.VideoMimeType,
&i.VideoDurationNanos,
&i.VideoThumbnailS3Key,
&i.VideoThumbnailS3UploadedAt,
&i.VideoThumbnailMimeType,
&i.VideoThumbnailWidth,
&i.VideoThumbnailHeight,
&i.CreatedAt,
&i.UpdatedAt,
&i.AudioContentLength,
&i.VideoContentLength,
&i.AudioEncodedS3Key,
&i.AudioEncodedS3UploadedAt,
&i.Title,
&i.Description,
&i.Author,
2021-12-05 10:53:33 +00:00
)
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_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, 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_key, audio_encoded_s3_uploaded_at, title, description, author FROM media_sets WHERE id = $1
2021-12-05 10:53:33 +00:00
`
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.AudioRawS3Key,
&i.AudioRawS3UploadedAt,
&i.AudioEncodedMimeType,
&i.VideoYoutubeItag,
&i.VideoS3Key,
&i.VideoS3UploadedAt,
&i.VideoMimeType,
&i.VideoDurationNanos,
&i.VideoThumbnailS3Key,
&i.VideoThumbnailS3UploadedAt,
&i.VideoThumbnailMimeType,
&i.VideoThumbnailWidth,
&i.VideoThumbnailHeight,
&i.CreatedAt,
&i.UpdatedAt,
&i.AudioContentLength,
&i.VideoContentLength,
&i.AudioEncodedS3Key,
&i.AudioEncodedS3UploadedAt,
&i.Title,
&i.Description,
&i.Author,
2021-12-05 10:53:33 +00:00
)
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_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, 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_key, audio_encoded_s3_uploaded_at, title, description, author FROM media_sets WHERE youtube_id = $1
2021-12-05 10:53:33 +00:00
`
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.AudioRawS3Key,
&i.AudioRawS3UploadedAt,
&i.AudioEncodedMimeType,
&i.VideoYoutubeItag,
&i.VideoS3Key,
&i.VideoS3UploadedAt,
&i.VideoMimeType,
&i.VideoDurationNanos,
&i.VideoThumbnailS3Key,
&i.VideoThumbnailS3UploadedAt,
&i.VideoThumbnailMimeType,
&i.VideoThumbnailWidth,
&i.VideoThumbnailHeight,
&i.CreatedAt,
&i.UpdatedAt,
&i.AudioContentLength,
&i.VideoContentLength,
&i.AudioEncodedS3Key,
&i.AudioEncodedS3UploadedAt,
&i.Title,
&i.Description,
&i.Author,
2021-12-05 10:53:33 +00:00
)
return i, err
}
const setEncodedAudioUploaded = `-- name: SetEncodedAudioUploaded :one
UPDATE media_sets
SET audio_encoded_s3_key = $2, audio_encoded_s3_uploaded_at = NOW(), updated_at = NOW()
2021-12-05 10:53:33 +00:00
WHERE id = $1
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, 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_key, audio_encoded_s3_uploaded_at, title, description, author
2021-12-05 10:53:33 +00:00
`
type SetEncodedAudioUploadedParams struct {
ID uuid.UUID
AudioEncodedS3Key sql.NullString
2021-12-05 10:53:33 +00:00
}
func (q *Queries) SetEncodedAudioUploaded(ctx context.Context, arg SetEncodedAudioUploadedParams) (MediaSet, error) {
row := q.db.QueryRow(ctx, setEncodedAudioUploaded, arg.ID, arg.AudioEncodedS3Key)
2021-12-05 10:53:33 +00:00
var i MediaSet
err := row.Scan(
&i.ID,
&i.YoutubeID,
&i.AudioYoutubeItag,
&i.AudioChannels,
&i.AudioFramesApprox,
&i.AudioFrames,
&i.AudioSampleRate,
&i.AudioRawS3Key,
&i.AudioRawS3UploadedAt,
&i.AudioEncodedMimeType,
&i.VideoYoutubeItag,
&i.VideoS3Key,
&i.VideoS3UploadedAt,
&i.VideoMimeType,
&i.VideoDurationNanos,
&i.VideoThumbnailS3Key,
&i.VideoThumbnailS3UploadedAt,
&i.VideoThumbnailMimeType,
&i.VideoThumbnailWidth,
&i.VideoThumbnailHeight,
&i.CreatedAt,
&i.UpdatedAt,
&i.AudioContentLength,
&i.VideoContentLength,
&i.AudioEncodedS3Key,
&i.AudioEncodedS3UploadedAt,
&i.Title,
&i.Description,
&i.Author,
2021-12-05 10:53:33 +00:00
)
return i, err
}
const setRawAudioUploaded = `-- name: SetRawAudioUploaded :one
UPDATE media_sets
SET audio_raw_s3_key = $2, audio_frames = $3, audio_raw_s3_uploaded_at = NOW(), updated_at = NOW()
2021-12-05 10:53:33 +00:00
WHERE id = $1
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, 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_key, audio_encoded_s3_uploaded_at, title, description, author
2021-12-05 10:53:33 +00:00
`
type SetRawAudioUploadedParams struct {
ID uuid.UUID
AudioRawS3Key sql.NullString
AudioFrames sql.NullInt64
2021-12-05 10:53:33 +00:00
}
func (q *Queries) SetRawAudioUploaded(ctx context.Context, arg SetRawAudioUploadedParams) (MediaSet, error) {
row := q.db.QueryRow(ctx, setRawAudioUploaded, arg.ID, arg.AudioRawS3Key, arg.AudioFrames)
2021-12-05 10:53:33 +00:00
var i MediaSet
err := row.Scan(
&i.ID,
&i.YoutubeID,
&i.AudioYoutubeItag,
&i.AudioChannels,
&i.AudioFramesApprox,
&i.AudioFrames,
&i.AudioSampleRate,
&i.AudioRawS3Key,
&i.AudioRawS3UploadedAt,
&i.AudioEncodedMimeType,
&i.VideoYoutubeItag,
&i.VideoS3Key,
&i.VideoS3UploadedAt,
&i.VideoMimeType,
&i.VideoDurationNanos,
&i.VideoThumbnailS3Key,
&i.VideoThumbnailS3UploadedAt,
&i.VideoThumbnailMimeType,
&i.VideoThumbnailWidth,
&i.VideoThumbnailHeight,
&i.CreatedAt,
&i.UpdatedAt,
&i.AudioContentLength,
&i.VideoContentLength,
&i.AudioEncodedS3Key,
&i.AudioEncodedS3UploadedAt,
&i.Title,
&i.Description,
&i.Author,
2021-12-05 10:53:33 +00:00
)
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_key = $5, video_thumbnail_s3_uploaded_at = NOW(), updated_at = NOW()
2021-12-05 10:53:33 +00:00
WHERE id = $1
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, 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_key, audio_encoded_s3_uploaded_at, title, description, author
2021-12-05 10:53:33 +00:00
`
type SetVideoThumbnailUploadedParams struct {
ID uuid.UUID
VideoThumbnailWidth sql.NullInt32
VideoThumbnailHeight sql.NullInt32
VideoThumbnailMimeType 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.VideoThumbnailS3Key,
)
var i MediaSet
err := row.Scan(
&i.ID,
&i.YoutubeID,
&i.AudioYoutubeItag,
&i.AudioChannels,
&i.AudioFramesApprox,
&i.AudioFrames,
&i.AudioSampleRate,
&i.AudioRawS3Key,
&i.AudioRawS3UploadedAt,
&i.AudioEncodedMimeType,
&i.VideoYoutubeItag,
&i.VideoS3Key,
&i.VideoS3UploadedAt,
&i.VideoMimeType,
&i.VideoDurationNanos,
&i.VideoThumbnailS3Key,
&i.VideoThumbnailS3UploadedAt,
&i.VideoThumbnailMimeType,
&i.VideoThumbnailWidth,
&i.VideoThumbnailHeight,
&i.CreatedAt,
&i.UpdatedAt,
&i.AudioContentLength,
&i.VideoContentLength,
&i.AudioEncodedS3Key,
&i.AudioEncodedS3UploadedAt,
&i.Title,
&i.Description,
&i.Author,
2021-12-05 10:53:33 +00:00
)
return i, err
}
const setVideoUploaded = `-- name: SetVideoUploaded :one
UPDATE media_sets
SET video_s3_key = $2, video_s3_uploaded_at = NOW(), updated_at = NOW()
2021-12-05 10:53:33 +00:00
WHERE id = $1
RETURNING id, youtube_id, audio_youtube_itag, audio_channels, audio_frames_approx, audio_frames, audio_sample_rate, audio_raw_s3_key, audio_raw_s3_uploaded_at, audio_encoded_mime_type, video_youtube_itag, video_s3_key, video_s3_uploaded_at, video_mime_type, video_duration_nanos, 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_key, audio_encoded_s3_uploaded_at, title, description, author
2021-12-05 10:53:33 +00:00
`
type SetVideoUploadedParams struct {
ID uuid.UUID
VideoS3Key sql.NullString
2021-12-05 10:53:33 +00:00
}
func (q *Queries) SetVideoUploaded(ctx context.Context, arg SetVideoUploadedParams) (MediaSet, error) {
row := q.db.QueryRow(ctx, setVideoUploaded, arg.ID, arg.VideoS3Key)
2021-12-05 10:53:33 +00:00
var i MediaSet
err := row.Scan(
&i.ID,
&i.YoutubeID,
&i.AudioYoutubeItag,
&i.AudioChannels,
&i.AudioFramesApprox,
&i.AudioFrames,
&i.AudioSampleRate,
&i.AudioRawS3Key,
&i.AudioRawS3UploadedAt,
&i.AudioEncodedMimeType,
&i.VideoYoutubeItag,
&i.VideoS3Key,
&i.VideoS3UploadedAt,
&i.VideoMimeType,
&i.VideoDurationNanos,
&i.VideoThumbnailS3Key,
&i.VideoThumbnailS3UploadedAt,
&i.VideoThumbnailMimeType,
&i.VideoThumbnailWidth,
&i.VideoThumbnailHeight,
&i.CreatedAt,
&i.UpdatedAt,
&i.AudioContentLength,
&i.VideoContentLength,
&i.AudioEncodedS3Key,
&i.AudioEncodedS3UploadedAt,
&i.Title,
&i.Description,
&i.Author,
2021-12-05 10:53:33 +00:00
)
return i, err
}