Skip to content
Snippets Groups Projects
Verified Commit 4555ef85 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Unexport DTOs

parent 2f87ad15
No related branches found
No related tags found
No related merge requests found
...@@ -95,7 +95,7 @@ type rawCoachSequenceFormation struct { ...@@ -95,7 +95,7 @@ type rawCoachSequenceFormation struct {
Type string `json:"zuggattung"` Type string `json:"zuggattung"`
TrainId string `json:"zugnummer"` TrainId string `json:"zugnummer"`
ServiceId string `json:"serviceid"` ServiceId string `json:"serviceid"`
StartingDate BahnDate `json:"planstarttag"` StartingDate bahnDate `json:"planstarttag"`
JourneyId string `json:"fahrtid"` JourneyId string `json:"fahrtid"`
IsPlannedFormation bool `json:"istplaninformation"` IsPlannedFormation bool `json:"istplaninformation"`
} }
...@@ -116,8 +116,8 @@ func parseCoachSequenceFormation(data rawCoachSequenceFormation) CoachSequenceFo ...@@ -116,8 +116,8 @@ func parseCoachSequenceFormation(data rawCoachSequenceFormation) CoachSequenceFo
} }
type rawCoachSequenceStop struct { type rawCoachSequenceStop struct {
Departure MediumBahnTime `json:"abfahrtszeit"` Departure mediumBahnTime `json:"abfahrtszeit"`
Arrival MediumBahnTime `json:"ankunftszeit"` Arrival mediumBahnTime `json:"ankunftszeit"`
Station string `json:"bahnhofsname"` Station string `json:"bahnhofsname"`
EvaId string `json:"evanummer"` EvaId string `json:"evanummer"`
Platform string `json:"gleisbezeichnung"` Platform string `json:"gleisbezeichnung"`
......
...@@ -32,13 +32,13 @@ func parseStations(data rawStations) []Station { ...@@ -32,13 +32,13 @@ func parseStations(data rawStations) []Station {
} }
type rawStation struct { type rawStation struct {
Platforms *BahnStringList `xml:"p,attr,omitempty"` Platforms *bahnStringList `xml:"p,attr,omitempty"`
Meta *BahnStringList `xml:"meta,attr,omitempty"` Meta *bahnStringList `xml:"meta,attr,omitempty"`
StationName string `xml:"name,attr,omitempty"` StationName string `xml:"name,attr,omitempty"`
EvaId string `xml:"eva,attr,omitempty"` EvaId string `xml:"eva,attr,omitempty"`
StationCode string `xml:"ds100,attr,omitempty"` StationCode string `xml:"ds100,attr,omitempty"`
Db bool `xml:"db,attr,omitempty"` Db bool `xml:"db,attr,omitempty"`
CreatedAt *BahnTime `xml:"creationts,attr,omitempty"` CreatedAt *bahnTime `xml:"creationts,attr,omitempty"`
} }
func parseStation(data rawStation) Station { func parseStation(data rawStation) Station {
......
...@@ -41,14 +41,14 @@ func parseTimetable(data rawTimetable) Timetable { ...@@ -41,14 +41,14 @@ func parseTimetable(data rawTimetable) Timetable {
type rawMessage struct { type rawMessage struct {
MessageId string `xml:"id,attr,omitempty"` MessageId string `xml:"id,attr,omitempty"`
Type rawMessageType `xml:"t,attr,omitempty"` Type rawMessageType `xml:"t,attr,omitempty"`
From *ShortBahnTime `xml:"from,attr,omitempty"` From *shortBahnTime `xml:"from,attr,omitempty"`
To *ShortBahnTime `xml:"to,attr,omitempty"` To *shortBahnTime `xml:"to,attr,omitempty"`
Code *int `xml:"c,attr,omitempty"` Code *int `xml:"c,attr,omitempty"`
InternalText string `xml:"int,attr,omitempty"` InternalText string `xml:"int,attr,omitempty"`
ExternalText string `xml:"ext,attr,omitempty"` ExternalText string `xml:"ext,attr,omitempty"`
Category string `xml:"cat,attr,omitempty"` Category string `xml:"cat,attr,omitempty"`
ExternalCategory string `xml:"ec,attr,omitempty"` ExternalCategory string `xml:"ec,attr,omitempty"`
Timestamp *ShortBahnTime `xml:"ts,attr,omitempty"` Timestamp *shortBahnTime `xml:"ts,attr,omitempty"`
Priority rawPriority `xml:"pr,attr,omitempty"` Priority rawPriority `xml:"pr,attr,omitempty"`
Owner string `xml:"o,attr,omitempty"` Owner string `xml:"o,attr,omitempty"`
ExternalLink string `xml:"elnk,attr,omitempty"` ExternalLink string `xml:"elnk,attr,omitempty"`
...@@ -187,7 +187,7 @@ type rawDistributorMessage struct { ...@@ -187,7 +187,7 @@ type rawDistributorMessage struct {
DistributorType rawDistributorType `xml:"t,attr,omitempty"` DistributorType rawDistributorType `xml:"t,attr,omitempty"`
DistributorName string `xml:"n,attr,omitempty"` DistributorName string `xml:"n,attr,omitempty"`
InternalText string `xml:"int,attr,omitempty"` InternalText string `xml:"int,attr,omitempty"`
Timestamp *ShortBahnTime `xml:"ts,attr,omitempty"` Timestamp *shortBahnTime `xml:"ts,attr,omitempty"`
} }
func parseDistributorMessages(data []rawDistributorMessage) []DistributorMessage { func parseDistributorMessages(data []rawDistributorMessage) []DistributorMessage {
...@@ -260,7 +260,7 @@ func parseTimetableStop(data rawTimetableStop) TimetableStop { ...@@ -260,7 +260,7 @@ func parseTimetableStop(data rawTimetableStop) TimetableStop {
type rawTripLabel struct { type rawTripLabel struct {
Messages []rawMessage `xml:"m,omitempty"` Messages []rawMessage `xml:"m,omitempty"`
CreatedAt *ShortBahnTime `xml:"ct,attr"` CreatedAt *shortBahnTime `xml:"ct,attr"`
FilterFlag rawFilterFlag `xml:"f,attr,omitempty"` FilterFlag rawFilterFlag `xml:"f,attr,omitempty"`
TripType rawTripType `xml:"t,attr,omitempty"` TripType rawTripType `xml:"t,attr,omitempty"`
Owner string `xml:"o,attr,omitempty"` Owner string `xml:"o,attr,omitempty"`
...@@ -343,9 +343,9 @@ func parseTripType(data rawTripType) TripType { ...@@ -343,9 +343,9 @@ func parseTripType(data rawTripType) TripType {
} }
type rawHistoricDelay struct { type rawHistoricDelay struct {
Timestamp *ShortBahnTime `xml:"ts,attr"` Timestamp *shortBahnTime `xml:"ts,attr"`
Arrival *ShortBahnTime `xml:"ar,attr"` Arrival *shortBahnTime `xml:"ar,attr"`
Departure *ShortBahnTime `xml:"dp,attr"` Departure *shortBahnTime `xml:"dp,attr"`
Source rawDelaySource `xml:"src,attr"` Source rawDelaySource `xml:"src,attr"`
Code string `xml:"cod,attr"` Code string `xml:"cod,attr"`
} }
...@@ -406,7 +406,7 @@ func parseDelaySource(data rawDelaySource) DelaySource { ...@@ -406,7 +406,7 @@ func parseDelaySource(data rawDelaySource) DelaySource {
} }
type rawHistoricPlatformChange struct { type rawHistoricPlatformChange struct {
Timestamp *ShortBahnTime `xml:"ts,attr,omitempty"` Timestamp *shortBahnTime `xml:"ts,attr,omitempty"`
ArrivalPlatform string `xml:"ar,attr,omitempty"` ArrivalPlatform string `xml:"ar,attr,omitempty"`
DeparturePlatform string `xml:"dp,attr,omitempty"` DeparturePlatform string `xml:"dp,attr,omitempty"`
Cause string `xml:"cot,attr,omitempty"` Cause string `xml:"cot,attr,omitempty"`
...@@ -431,7 +431,7 @@ func parseHistoricPlatformChange(data rawHistoricPlatformChange) HistoricPlatfor ...@@ -431,7 +431,7 @@ func parseHistoricPlatformChange(data rawHistoricPlatformChange) HistoricPlatfor
type rawConnection struct { type rawConnection struct {
ConnectionId string `xml:"id,attr,omitempty"` ConnectionId string `xml:"id,attr,omitempty"`
Timestamp *ShortBahnTime `xml:"ts,attr,omitempty"` Timestamp *shortBahnTime `xml:"ts,attr,omitempty"`
EvaId int64 `xml:"eva,attr,omitempty"` EvaId int64 `xml:"eva,attr,omitempty"`
ConnectionStatus rawConnectionStatus `xml:"cs,attr,omitempty"` ConnectionStatus rawConnectionStatus `xml:"cs,attr,omitempty"`
Ref *rawTimetableStop `xml:"ref,omitempty"` Ref *rawTimetableStop `xml:"ref,omitempty"`
...@@ -519,12 +519,12 @@ type rawEvent struct { ...@@ -519,12 +519,12 @@ type rawEvent struct {
Messages []rawMessage `xml:"m,omitempty"` Messages []rawMessage `xml:"m,omitempty"`
PlannedPlatform string `xml:"pp,attr,omitempty"` PlannedPlatform string `xml:"pp,attr,omitempty"`
PlannedTime *ShortBahnTime `xml:"pt,attr,omitempty"` PlannedTime *shortBahnTime `xml:"pt,attr,omitempty"`
PlannedPath *BahnStringList `xml:"ppth,attr,omitempty"` PlannedPath *bahnStringList `xml:"ppth,attr,omitempty"`
PlannedDestination string `xml:"pde,attr,omitempty"` PlannedDestination string `xml:"pde,attr,omitempty"`
ChangedPlatform string `xml:"cp,attr,omitempty"` ChangedPlatform string `xml:"cp,attr,omitempty"`
ChangedTime *ShortBahnTime `xml:"ct,attr"` ChangedTime *shortBahnTime `xml:"ct,attr"`
ChangedPath *BahnStringList `xml:"cpth,attr,omitempty"` ChangedPath *bahnStringList `xml:"cpth,attr,omitempty"`
ChangedDestination string `xml:"cde,attr,omitempty"` ChangedDestination string `xml:"cde,attr,omitempty"`
PlannedStatus rawEventStatus `xml:"ps,attr,omitempty"` PlannedStatus rawEventStatus `xml:"ps,attr,omitempty"`
ChangedStatus rawEventStatus `xml:"cs,attr,omitempty"` ChangedStatus rawEventStatus `xml:"cs,attr,omitempty"`
......
...@@ -7,9 +7,9 @@ import ( ...@@ -7,9 +7,9 @@ import (
"time" "time"
) )
type BahnStringList []string type bahnStringList []string
func (s *BahnStringList) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { func (s *bahnStringList) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
if s == nil { if s == nil {
return xml.Attr{}, nil return xml.Attr{}, nil
} else { } else {
...@@ -20,12 +20,12 @@ func (s *BahnStringList) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { ...@@ -20,12 +20,12 @@ func (s *BahnStringList) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
} }
} }
func (s *BahnStringList) UnmarshalXMLAttr(attr xml.Attr) error { func (s *bahnStringList) UnmarshalXMLAttr(attr xml.Attr) error {
*s = strings.Split(attr.Value, "|") *s = strings.Split(attr.Value, "|")
return nil return nil
} }
func (s *BahnStringList) Value() []string { func (s *bahnStringList) Value() []string {
if s != nil { if s != nil {
return *s return *s
} else { } else {
...@@ -33,26 +33,26 @@ func (s *BahnStringList) Value() []string { ...@@ -33,26 +33,26 @@ func (s *BahnStringList) Value() []string {
} }
} }
type BahnTime struct { type bahnTime struct {
time.Time time.Time
} }
const BahnTimeLayout = "06-01-02 15:04:05.999" const bahnTimeLayout = "06-01-02 15:04:05.999"
func (t *BahnTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { func (t *bahnTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
if t == nil || t.IsZero() { if t == nil || t.IsZero() {
return xml.Attr{}, nil return xml.Attr{}, nil
} else { } else {
return xml.Attr{ return xml.Attr{
Name: name, Name: name,
Value: t.Format(BahnTimeLayout), Value: t.Format(bahnTimeLayout),
}, nil }, nil
} }
} }
func (t *BahnTime) UnmarshalXMLAttr(attr xml.Attr) error { func (t *bahnTime) UnmarshalXMLAttr(attr xml.Attr) error {
if attr.Value != "" { if attr.Value != "" {
value, err := time.Parse(BahnTimeLayout, attr.Value) value, err := time.Parse(bahnTimeLayout, attr.Value)
if err != nil { if err != nil {
return err return err
} }
...@@ -61,7 +61,7 @@ func (t *BahnTime) UnmarshalXMLAttr(attr xml.Attr) error { ...@@ -61,7 +61,7 @@ func (t *BahnTime) UnmarshalXMLAttr(attr xml.Attr) error {
return nil return nil
} }
func (t *BahnTime) Value() *time.Time { func (t *bahnTime) Value() *time.Time {
if t != nil { if t != nil {
return &t.Time return &t.Time
} else { } else {
...@@ -69,26 +69,26 @@ func (t *BahnTime) Value() *time.Time { ...@@ -69,26 +69,26 @@ func (t *BahnTime) Value() *time.Time {
} }
} }
type ShortBahnTime struct { type shortBahnTime struct {
time.Time time.Time
} }
const ShortBahnTimeLayout = "0601021504" const shortBahnTimeLayout = "0601021504"
func (t *ShortBahnTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { func (t *shortBahnTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
if t == nil || t.IsZero() { if t == nil || t.IsZero() {
return xml.Attr{}, nil return xml.Attr{}, nil
} else { } else {
return xml.Attr{ return xml.Attr{
Name: name, Name: name,
Value: t.Format(ShortBahnTimeLayout), Value: t.Format(shortBahnTimeLayout),
}, nil }, nil
} }
} }
func (t *ShortBahnTime) UnmarshalXMLAttr(attr xml.Attr) error { func (t *shortBahnTime) UnmarshalXMLAttr(attr xml.Attr) error {
if attr.Value != "" { if attr.Value != "" {
value, err := time.Parse(ShortBahnTimeLayout, attr.Value) value, err := time.Parse(shortBahnTimeLayout, attr.Value)
if err != nil { if err != nil {
return err return err
} }
...@@ -97,7 +97,7 @@ func (t *ShortBahnTime) UnmarshalXMLAttr(attr xml.Attr) error { ...@@ -97,7 +97,7 @@ func (t *ShortBahnTime) UnmarshalXMLAttr(attr xml.Attr) error {
return nil return nil
} }
func (t *ShortBahnTime) Value() *time.Time { func (t *shortBahnTime) Value() *time.Time {
if t != nil { if t != nil {
return &t.Time return &t.Time
} else { } else {
...@@ -105,26 +105,26 @@ func (t *ShortBahnTime) Value() *time.Time { ...@@ -105,26 +105,26 @@ func (t *ShortBahnTime) Value() *time.Time {
} }
} }
type MediumBahnTime struct { type mediumBahnTime struct {
time.Time time.Time
} }
const MediumBahnTimeLayout = "2006-01-02T15:04:05" const mediumBahnTimeLayout = "2006-01-02T15:04:05"
func (t *MediumBahnTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { func (t *mediumBahnTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
if t == nil || t.IsZero() { if t == nil || t.IsZero() {
return xml.Attr{}, nil return xml.Attr{}, nil
} else { } else {
return xml.Attr{ return xml.Attr{
Name: name, Name: name,
Value: t.Format(MediumBahnTimeLayout), Value: t.Format(mediumBahnTimeLayout),
}, nil }, nil
} }
} }
func (t *MediumBahnTime) UnmarshalXMLAttr(attr xml.Attr) error { func (t *mediumBahnTime) UnmarshalXMLAttr(attr xml.Attr) error {
if attr.Value != "" { if attr.Value != "" {
value, err := time.Parse(MediumBahnTimeLayout, attr.Value) value, err := time.Parse(mediumBahnTimeLayout, attr.Value)
if err != nil { if err != nil {
return err return err
} }
...@@ -133,17 +133,17 @@ func (t *MediumBahnTime) UnmarshalXMLAttr(attr xml.Attr) error { ...@@ -133,17 +133,17 @@ func (t *MediumBahnTime) UnmarshalXMLAttr(attr xml.Attr) error {
return nil return nil
} }
func (t *MediumBahnTime) MarshalJSON() ([]byte, error) { func (t *mediumBahnTime) MarshalJSON() ([]byte, error) {
var text string var text string
if t == nil || t.IsZero() { if t == nil || t.IsZero() {
text = "" text = ""
} else { } else {
text = t.Format(MediumBahnTimeLayout) text = t.Format(mediumBahnTimeLayout)
} }
return json.Marshal(&text) return json.Marshal(&text)
} }
func (t *MediumBahnTime) UnmarshalJSON(data []byte) error { func (t *mediumBahnTime) UnmarshalJSON(data []byte) error {
var err error var err error
var text string var text string
...@@ -153,7 +153,7 @@ func (t *MediumBahnTime) UnmarshalJSON(data []byte) error { ...@@ -153,7 +153,7 @@ func (t *MediumBahnTime) UnmarshalJSON(data []byte) error {
if text != "" { if text != "" {
var value time.Time var value time.Time
if value, err = time.Parse(MediumBahnTimeLayout, text); err != nil { if value, err = time.Parse(mediumBahnTimeLayout, text); err != nil {
return err return err
} }
t.Time = value t.Time = value
...@@ -161,7 +161,7 @@ func (t *MediumBahnTime) UnmarshalJSON(data []byte) error { ...@@ -161,7 +161,7 @@ func (t *MediumBahnTime) UnmarshalJSON(data []byte) error {
return nil return nil
} }
func (t *MediumBahnTime) Value() *time.Time { func (t *mediumBahnTime) Value() *time.Time {
if t != nil { if t != nil {
return &t.Time return &t.Time
} else { } else {
...@@ -169,26 +169,26 @@ func (t *MediumBahnTime) Value() *time.Time { ...@@ -169,26 +169,26 @@ func (t *MediumBahnTime) Value() *time.Time {
} }
} }
type BahnDate struct { type bahnDate struct {
time.Time time.Time
} }
const BahnDateLayout = "2006-01-02" const bahnDateLayout = "2006-01-02"
func (t *BahnDate) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { func (t *bahnDate) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
if t == nil || t.IsZero() { if t == nil || t.IsZero() {
return xml.Attr{}, nil return xml.Attr{}, nil
} else { } else {
return xml.Attr{ return xml.Attr{
Name: name, Name: name,
Value: t.Format(BahnDateLayout), Value: t.Format(bahnDateLayout),
}, nil }, nil
} }
} }
func (t *BahnDate) UnmarshalXMLAttr(attr xml.Attr) error { func (t *bahnDate) UnmarshalXMLAttr(attr xml.Attr) error {
if attr.Value != "" { if attr.Value != "" {
value, err := time.Parse(BahnDateLayout, attr.Value) value, err := time.Parse(bahnDateLayout, attr.Value)
if err != nil { if err != nil {
return err return err
} }
...@@ -197,17 +197,17 @@ func (t *BahnDate) UnmarshalXMLAttr(attr xml.Attr) error { ...@@ -197,17 +197,17 @@ func (t *BahnDate) UnmarshalXMLAttr(attr xml.Attr) error {
return nil return nil
} }
func (t *BahnDate) MarshalJSON() ([]byte, error) { func (t *bahnDate) MarshalJSON() ([]byte, error) {
var text string var text string
if t == nil || t.IsZero() { if t == nil || t.IsZero() {
text = "" text = ""
} else { } else {
text = t.Format(BahnDateLayout) text = t.Format(bahnDateLayout)
} }
return json.Marshal(&text) return json.Marshal(&text)
} }
func (t *BahnDate) UnmarshalJSON(data []byte) error { func (t *bahnDate) UnmarshalJSON(data []byte) error {
var err error var err error
var text string var text string
...@@ -217,7 +217,7 @@ func (t *BahnDate) UnmarshalJSON(data []byte) error { ...@@ -217,7 +217,7 @@ func (t *BahnDate) UnmarshalJSON(data []byte) error {
if text != "" { if text != "" {
var value time.Time var value time.Time
if value, err = time.Parse(BahnDateLayout, text); err != nil { if value, err = time.Parse(bahnDateLayout, text); err != nil {
return err return err
} }
t.Time = value t.Time = value
...@@ -225,7 +225,7 @@ func (t *BahnDate) UnmarshalJSON(data []byte) error { ...@@ -225,7 +225,7 @@ func (t *BahnDate) UnmarshalJSON(data []byte) error {
return nil return nil
} }
func (t *BahnDate) Value() *time.Time { func (t *bahnDate) Value() *time.Time {
if t != nil { if t != nil {
return &t.Time return &t.Time
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment