feat: now PostImage return Image struct even on duplicate data
This commit is contained in:
parent
c58b578023
commit
4fe077d229
3 changed files with 55 additions and 29 deletions
|
|
@ -102,6 +102,19 @@ func (q *Queries) GetImageByID(ctx context.Context, illustID int64) (Image, erro
|
|||
return i, err
|
||||
}
|
||||
|
||||
const getImageByPath = `-- name: GetImageByPath :one
|
||||
SELECT id, storage_type, image_path
|
||||
FROM images
|
||||
WHERE image_path = $1::text
|
||||
`
|
||||
|
||||
func (q *Queries) GetImageByPath(ctx context.Context, illustPath string) (Image, error) {
|
||||
row := q.db.QueryRow(ctx, getImageByPath, illustPath)
|
||||
var i Image
|
||||
err := row.Scan(&i.ID, &i.StorageType, &i.ImagePath)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getReviewByID = `-- name: GetReviewByID :one
|
||||
|
||||
SELECT id, data, rating, user_id, title_id, created_at
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue