You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my schema i have a Job that always has a foreign key to a video. I'd like the Job struct to have an embedded video every time i am using it. I can achieve this on a select doing the following:
-- name: GetJobEmbedVideo :one
SELECT sqlc.embed(videos), job.*
FROM job
JOIN videos ON job.video_id= videos.id
WHERE job.id = $1;
output struct:
type GetJobEmbedVideoRow struct {
Video Video `json:"video"`
ID int32 `json:"id"`
Action string `json:"action"`
VideoID uuid.UUID `json:"video_id"`
Completed bool `json:"completed"`
Errored bool `json:"errored"`
Attempts int32 `json:"attempts"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
but I can't seem to get it to work when inserting a job. I've tried
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In my schema i have a Job that always has a foreign key to a video. I'd like the Job struct to have an embedded video every time i am using it. I can achieve this on a select doing the following:
output struct:
but I can't seem to get it to work when inserting a job. I've tried
which won't compile.
gives:
What is the correct SQL for this to work on insert (and hopefully update as well)
Beta Was this translation helpful? Give feedback.
All reactions