Conditions | 2 |
Total Lines | 11 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | package repository |
||
18 | func (r *RoomPostgres) Create(room *model.Room) (int, error) { |
||
19 | 1 | var id int |
|
20 | 1 | query := fmt.Sprintf( |
|
21 | `INSERT INTO %s (description, price) VALUES ($1, $2) RETURNING id`, |
||
22 | roomsTable) |
||
23 | 1 | row := r.db.QueryRow(query, room.Description, room.Price) |
|
24 | 1 | if err := row.Scan(&id); err != nil { |
|
25 | 1 | return 0, err |
|
26 | } |
||
27 | |||
28 | 1 | return id, nil |
|
29 | } |
||
57 |