forked from tellytv/telly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (31 loc) · 1.11 KB
/
main.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
package models
import (
"github.com/jmoiron/sqlx"
"github.com/sirupsen/logrus"
"gopkg.in/Masterminds/squirrel.v1"
)
var sq = squirrel.StatementBuilder.PlaceholderFormat(squirrel.Dollar) // nolint
// APICollection is a struct containing all models.
type APICollection struct {
GuideSource GuideSourceAPI
GuideSourceChannel GuideSourceChannelAPI
GuideSourceProgramme GuideSourceProgrammeAPI
Lineup LineupAPI
LineupChannel LineupChannelAPI
VideoSource VideoSourceAPI
VideoSourceTrack VideoSourceTrackAPI
}
var log = &logrus.Logger{}
// NewAPICollection returns an initialized APICollection struct.
func NewAPICollection(db *sqlx.DB, logger *logrus.Logger) *APICollection {
log = logger
api := &APICollection{}
api.GuideSource = newGuideSourceDB(db, api)
api.GuideSourceChannel = newGuideSourceChannelDB(db, api)
api.GuideSourceProgramme = newGuideSourceProgrammeDB(db, api)
api.Lineup = newLineupDB(db, api)
api.LineupChannel = newLineupChannelDB(db, api)
api.VideoSource = newVideoSourceDB(db, api)
api.VideoSourceTrack = newVideoSourceTrackDB(db, api)
return api
}