pkg/repository/repository.go   A
last analyzed

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
cc 1
eloc 21
dl 0
loc 30
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A repository.NewRepository 0 4 1
1
package repository
2
3
import (
4
	"github.com/architectv/estate-task/pkg/model"
5
	"github.com/jmoiron/sqlx"
6
)
7
8
type Room interface {
9
	Create(room *model.Room) (int, error)
10
	Delete(id int) error
11
	GetAll(sortField string, desc bool) ([]*model.Room, error)
12
	GetById(id int) (*model.Room, error)
13
}
14
15
type Booking interface {
16
	Create(booking *model.Booking) (int, error)
17
	Delete(id int) error
18
	GetByRoomId(roomId int) ([]*model.Booking, error)
19
	GetById(id int) (*model.Booking, error)
20
}
21
22
type Repository struct {
23
	Room
24
	Booking
25
}
26
27
func NewRepository(db *sqlx.DB) *Repository {
28
	return &Repository{
29
		Room:    NewRoomPostgres(db),
30
		Booking: NewBookingPostgres(db),
31
	}
32
}
33