tb/main #1
|
@ -7,7 +7,9 @@ import (
|
||||||
|
|
||||||
func (database *Database) FindClaimsByProductID(product_id int) (claims []models.Claim, err error) {
|
func (database *Database) FindClaimsByProductID(product_id int) (claims []models.Claim, err error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
err = database.db.Query(ctx, claims, `SELECT
|
|
||||||
|
err = database.db.Query(ctx, claims, `
|
||||||
|
SELECT
|
||||||
cluster,
|
cluster,
|
||||||
id,
|
id,
|
||||||
worker_type,
|
worker_type,
|
||||||
|
@ -17,7 +19,7 @@ func (database *Database) FindClaimsByProductID(product_id int) (claims []models
|
||||||
polarity,
|
polarity,
|
||||||
created_at,
|
created_at,
|
||||||
created_by
|
created_by
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
cluster,
|
cluster,
|
||||||
id,
|
id,
|
||||||
|
@ -43,10 +45,11 @@ FROM (
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
WHERE product_id = ?
|
WHERE product_id = ?
|
||||||
)
|
)
|
||||||
WHERE rn = 1
|
WHERE rn = 1
|
||||||
ORDER BY created_at;
|
ORDER BY created_at;
|
||||||
`, product_id)
|
`, product_id)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return claims, err
|
return claims, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue