Setting back to functioning route

main
Drew Bednar 4 hours ago
parent b1d68e2877
commit 84bdcd8ce6

@ -52,23 +52,23 @@ func (m MovieModel) Get(ctx context.Context, id int64) (*Movie, error) {
return nil, ErrRecordNotFound
}
// query := `
// SELECT id, created_at, title, year, runtime, genres, version
// FROM movies
// WHERE id = $1
// `
// Mimicking a long running query. FYI since this changes the number of returned
// fields, so I implmented the throwaway variable to take care of that
query := `
SELECT pg_sleep(8), id, created_at, title, year, runtime, genres, version
SELECT id, created_at, title, year, runtime, genres, version
FROM movies
WHERE id = $1
`
// Mimicking a long running query. FYI since this changes the number of returned
// fields, so I implmented the throwaway variable to take care of that
// query := `
// SELECT pg_sleep(8), id, created_at, title, year, runtime, genres, version
// FROM movies
// WHERE id = $1
// `
var movie Movie
err := m.pool.QueryRow(ctx, query, id).Scan(
&[]byte{}, // throwaway the pg_sleep value
// &[]byte{}, // throwaway the pg_sleep value
&movie.ID,
&movie.CreatedAt,
&movie.Title,

Loading…
Cancel
Save