-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmodels.go
More file actions
195 lines (161 loc) · 3.74 KB
/
models.go
File metadata and controls
195 lines (161 loc) · 3.74 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
package model
import (
"encoding/json"
"time"
"github.com/interline-io/transitland-lib/dmfr"
"github.com/interline-io/transitland-lib/gtfs"
"github.com/interline-io/transitland-lib/rt/pb"
"github.com/interline-io/transitland-lib/service"
"github.com/interline-io/transitland-lib/tlxy"
"github.com/interline-io/transitland-lib/tt"
)
type ServiceWindow struct {
NowLocal time.Time
StartDate time.Time
EndDate time.Time
FallbackWeek time.Time
}
type StopPlaceParam struct {
ID int
Point tlxy.Point
}
//////////
type Feed struct {
WithOperatorOnestopID tt.String
SearchRank *string
dmfr.Feed
}
type FeedLicense struct {
dmfr.FeedLicense
}
type FeedUrls struct {
dmfr.FeedUrls
}
type FeedAuthorization struct {
dmfr.FeedAuthorization
}
type StopExternalReference struct {
dmfr.StopExternalReference
}
type Agency struct {
OnestopID string `json:"onestop_id"`
FeedOnestopID string `json:"feed_onestop_id"`
FeedVersionSHA1 string `json:"feed_version_sha1"`
Geometry *tt.Polygon `json:"geometry"`
SearchRank *string
CoifID *int
gtfs.Agency
}
type Calendar struct {
gtfs.Calendar
}
type FeedState struct {
dmfr.FeedState
}
type FeedFetch struct {
ResponseSha1 tt.String // confusing but easier than alternative fixes
dmfr.FeedFetch
}
type FeedVersion struct {
SHA1Dir tt.String `json:"sha1_dir"`
dmfr.FeedVersion
}
type Operator struct {
ID int
Generated bool
FeedID int
FeedOnestopID *string
SearchRank *string // internal
AgencyID int // internal
dmfr.Operator
}
type Route struct {
FeedOnestopID string
FeedVersionSHA1 string
OnestopID *string
HeadwaySecondsWeekdayMorning *int
SearchRank *string
gtfs.Route
}
type Trip struct {
RTTripID string // internal: for ADDED trips
gtfs.Trip
}
type RTStopTimeUpdate struct {
LastDelay *int32
StopTimeUpdate *pb.TripUpdate_StopTimeUpdate
TripUpdate *pb.TripUpdate
}
type StopTime struct {
ServiceDate tt.Date
Date tt.Date
RTTripID string // internal: for ADDED trips
RTStopTimeUpdate *RTStopTimeUpdate // internal
gtfs.StopTime
}
type Stop struct {
FeedOnestopID string
FeedVersionSHA1 string
OnestopID *string
SearchRank *string
WithinFeatures tt.Strings
WithRouteID tt.Int
gtfs.Stop
}
type Frequency struct {
gtfs.Frequency
}
type CalendarDate struct {
gtfs.CalendarDate
}
type Shape struct {
service.ShapeLine
}
type Level struct {
Geometry tt.MultiPolygon
ParentStation tt.Key
gtfs.Level
}
type FeedInfo struct {
gtfs.FeedInfo
}
type Pathway struct {
gtfs.Pathway
}
type FeedVersionFileInfo struct {
dmfr.FeedVersionFileInfo
}
type FeedVersionGtfsImport struct {
WarningCount *json.RawMessage `json:"warning_count"`
EntityCount *json.RawMessage `json:"entity_count"`
SkipEntityErrorCount *json.RawMessage `json:"skip_entity_error_count"`
SkipEntityReferenceCount *json.RawMessage `json:"skip_entity_reference_count"`
SkipEntityFilterCount *json.RawMessage `json:"skip_entity_filter_count"`
SkipEntityMarkedCount *json.RawMessage `json:"skip_entity_marked_count"`
dmfr.FeedVersionImport
}
type FeedVersionServiceLevel struct {
dmfr.FeedVersionServiceLevel
}
// Some enum helpers
var specTypeMap = map[string]FeedSpecTypes{
"gtfs": FeedSpecTypesGtfs,
"gtfs-rt": FeedSpecTypesGtfsRt,
"gbfs": FeedSpecTypesGbfs,
"mds": FeedSpecTypesMds,
}
func (f FeedSpecTypes) ToDBString() string {
for k, v := range specTypeMap {
if f == v {
return k
}
}
return ""
}
func (f FeedSpecTypes) FromDBString(s string) *FeedSpecTypes {
a, ok := specTypeMap[s]
if !ok {
return nil
}
return &a
}