-
Notifications
You must be signed in to change notification settings - Fork 0
/
programme.go
79 lines (62 loc) · 2.09 KB
/
programme.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package programme
import (
"context"
"time"
"github.com/jmoiron/sqlx"
)
type (
// Store stores the dependencies
Store struct {
db *sqlx.DB
}
Programme struct {
ID int `db:"id" json:"id"`
Name string `db:"name" json:"name"`
FileName string `db:"file_name" json:"file_name"`
DateOfProgramme time.Time `db:"date_of_programme" json:"date_of_programme"`
SeasonID int `db:"programme_season_id" json:"season_id"`
}
Season struct {
ID int `db:"id" json:"id"`
Season string `db:"season" json:"season"`
}
)
// NewProgrammeRepo stores our dependency
func NewProgrammeRepo(db *sqlx.DB) *Store {
return &Store{
db: db,
}
}
func (s *Store) GetProgrammes(ctx context.Context) ([]Programme, error) {
return s.getProgrammes(ctx)
}
func (s *Store) GetProgrammesSeason(ctx context.Context, seasonParam Season) ([]Programme, error) {
return s.getProgrammesSeason(ctx, seasonParam)
}
func (s *Store) GetProgramme(ctx context.Context, programmeParam Programme) (Programme, error) {
return s.getProgramme(ctx, programmeParam)
}
func (s *Store) AddProgramme(ctx context.Context, programmeParam Programme) (Programme, error) {
return s.addProgramme(ctx, programmeParam)
}
func (s *Store) EditProgramme(ctx context.Context, programmeParam Programme) (Programme, error) {
return s.editProgramme(ctx, programmeParam)
}
func (s *Store) DeleteProgramme(ctx context.Context, programmeParam Programme) error {
return s.deleteProgramme(ctx, programmeParam)
}
func (s *Store) GetSeasons(ctx context.Context) ([]Season, error) {
return s.getSeasons(ctx)
}
func (s *Store) GetSeason(ctx context.Context, seasonParam Season) (Season, error) {
return s.getSeason(ctx, seasonParam)
}
func (s *Store) AddSeason(ctx context.Context, seasonParam Season) (Season, error) {
return s.addSeason(ctx, seasonParam)
}
func (s *Store) EditSeason(ctx context.Context, seasonParam Season) (Season, error) {
return s.editSeason(ctx, seasonParam)
}
func (s *Store) DeleteSeason(ctx context.Context, seasonParam Season) error {
return s.deleteSeason(ctx, seasonParam)
}