// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.20.0 // source: reviews.sql package db import ( "context" "database/sql" ) const checkIfReviewExists = `-- name: CheckIfReviewExists :one SELECT COUNT(1) FROM reviews WHERE reviews.location_id = $1 AND reviews.submitted_by = $2 ` type CheckIfReviewExistsParams struct { LocationID int32 `json:"location_id"` SubmittedBy int32 `json:"submitted_by"` } func (q *Queries) CheckIfReviewExists(ctx context.Context, arg CheckIfReviewExistsParams) (int64, error) { row := q.db.QueryRowContext(ctx, checkIfReviewExists, arg.LocationID, arg.SubmittedBy) var count int64 err := row.Scan(&count) return count, err } const getUserReviewByLocation = `-- name: GetUserReviewByLocation :one SELECT re.id, re.location_id, re.score, re.comments, re.created_at, re.updated_at FROM reviews re WHERE submitted_by = $1 AND location_id = $2 ` type GetUserReviewByLocationParams struct { SubmittedBy int32 `json:"submitted_by"` LocationID int32 `json:"location_id"` } type GetUserReviewByLocationRow struct { ID int32 `json:"id"` LocationID int32 `json:"location_id"` Score int16 `json:"score"` Comments string `json:"comments"` CreatedAt sql.NullTime `json:"created_at"` UpdatedAt sql.NullTime `json:"updated_at"` } func (q *Queries) GetUserReviewByLocation(ctx context.Context, arg GetUserReviewByLocationParams) (GetUserReviewByLocationRow, error) { row := q.db.QueryRowContext(ctx, getUserReviewByLocation, arg.SubmittedBy, arg.LocationID) var i GetUserReviewByLocationRow err := row.Scan( &i.ID, &i.LocationID, &i.Score, &i.Comments, &i.CreatedAt, &i.UpdatedAt, ) return i, err }