mirror of
				https://github.com/3ybactuk/marketplace-go-service-project.git
				synced 2025-10-31 06:23:44 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			644 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			644 B
		
	
	
	
		
			SQL
		
	
	
	
	
	
| -- name: InsertComment :one
 | |
| INSERT INTO comments (id, user_id, sku, text) VALUES ($1, $2, $3, $4)
 | |
| RETURNING id, user_id, sku, text, created_at;
 | |
| 
 | |
| -- name: GetCommentByID :one
 | |
| SELECT id, user_id, sku, text, created_at FROM comments WHERE id = $1;
 | |
| 
 | |
| -- name: UpdateComment :one
 | |
| UPDATE comments
 | |
| SET text = $2
 | |
| WHERE id = $1
 | |
| RETURNING id, user_id, sku, text, created_at;
 | |
| 
 | |
| -- name: ListCommentsBySku :many
 | |
| SELECT id, user_id, sku, text, created_at
 | |
| FROM comments
 | |
| WHERE sku = $1
 | |
| ORDER BY created_at DESC, user_id ASC;
 | |
| 
 | |
| -- name: ListCommentsByUser :many
 | |
| SELECT id, user_id, sku, text, created_at
 | |
| FROM comments
 | |
| WHERE user_id = $1
 | |
| ORDER BY created_at DESC;
 | 
