Conditions | 2 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | package repository |
||
38 | func (r *RoomPostgres) GetAll(sortField string, desc bool) ([]*model.Room, error) { |
||
39 | 1 | var rooms []*model.Room |
|
40 | |||
41 | 1 | query := fmt.Sprintf("SELECT * FROM %s ORDER BY %s", roomsTable, sortField) |
|
42 | 1 | if desc { |
|
43 | 1 | query += " DESC" |
|
44 | } |
||
45 | 1 | err := r.db.Select(&rooms, query) |
|
46 | |||
47 | 1 | return rooms, err |
|
48 | } |
||
57 |