[hw-8] attempt to fix tests

This commit is contained in:
3ybacTuK
2025-07-28 22:11:42 +03:00
parent 6e0d90a6d5
commit 61757d1a52
8 changed files with 676 additions and 66 deletions

View File

@@ -27,18 +27,24 @@ func (q *Queries) GetCommentByID(ctx context.Context, id int64) (*Comment, error
}
const insertComment = `-- name: InsertComment :one
INSERT INTO comments (user_id, sku, text) VALUES ($1, $2, $3)
INSERT INTO comments (id, user_id, sku, text) VALUES ($1, $2, $3, $4)
RETURNING id, user_id, sku, text, created_at
`
type InsertCommentParams struct {
ID int64
UserID int64
Sku int64
Text string
}
func (q *Queries) InsertComment(ctx context.Context, arg *InsertCommentParams) (*Comment, error) {
row := q.db.QueryRow(ctx, insertComment, arg.UserID, arg.Sku, arg.Text)
row := q.db.QueryRow(ctx, insertComment,
arg.ID,
arg.UserID,
arg.Sku,
arg.Text,
)
var i Comment
err := row.Scan(
&i.ID,