mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 14:03:45 +03:00
[hw-8] attempt to fix tests
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user