Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bahn-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Janne Mareike Koschinski
bahn-api
Commits
4555ef85
Verified
Commit
4555ef85
authored
6 years ago
by
Janne Mareike Koschinski
Browse files
Options
Downloads
Patches
Plain Diff
Unexport DTOs
parent
2f87ad15
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
external_coachsequence.go
+3
-3
3 additions, 3 deletions
external_coachsequence.go
external_station.go
+3
-3
3 additions, 3 deletions
external_station.go
external_timetable.go
+14
-14
14 additions, 14 deletions
external_timetable.go
types_util.go
+40
-40
40 additions, 40 deletions
types_util.go
with
60 additions
and
60 deletions
external_coachsequence.go
+
3
−
3
View file @
4555ef85
...
@@ -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
B
ahnDate
`json:"planstarttag"`
StartingDate
b
ahnDate
`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
M
ediumBahnTime
`json:"abfahrtszeit"`
Departure
m
ediumBahnTime
`json:"abfahrtszeit"`
Arrival
M
ediumBahnTime
`json:"ankunftszeit"`
Arrival
m
ediumBahnTime
`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"`
...
...
This diff is collapsed.
Click to expand it.
external_station.go
+
3
−
3
View file @
4555ef85
...
@@ -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
*
B
ahnStringList
`xml:"p,attr,omitempty"`
Platforms
*
b
ahnStringList
`xml:"p,attr,omitempty"`
Meta
*
B
ahnStringList
`xml:"meta,attr,omitempty"`
Meta
*
b
ahnStringList
`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
*
B
ahnTime
`xml:"creationts,attr,omitempty"`
CreatedAt
*
b
ahnTime
`xml:"creationts,attr,omitempty"`
}
}
func
parseStation
(
data
rawStation
)
Station
{
func
parseStation
(
data
rawStation
)
Station
{
...
...
This diff is collapsed.
Click to expand it.
external_timetable.go
+
14
−
14
View file @
4555ef85
...
@@ -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
*
S
hortBahnTime
`xml:"from,attr,omitempty"`
From
*
s
hortBahnTime
`xml:"from,attr,omitempty"`
To
*
S
hortBahnTime
`xml:"to,attr,omitempty"`
To
*
s
hortBahnTime
`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
*
S
hortBahnTime
`xml:"ts,attr,omitempty"`
Timestamp
*
s
hortBahnTime
`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
*
S
hortBahnTime
`xml:"ts,attr,omitempty"`
Timestamp
*
s
hortBahnTime
`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
*
S
hortBahnTime
`xml:"ct,attr"`
CreatedAt
*
s
hortBahnTime
`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
*
S
hortBahnTime
`xml:"ts,attr"`
Timestamp
*
s
hortBahnTime
`xml:"ts,attr"`
Arrival
*
S
hortBahnTime
`xml:"ar,attr"`
Arrival
*
s
hortBahnTime
`xml:"ar,attr"`
Departure
*
S
hortBahnTime
`xml:"dp,attr"`
Departure
*
s
hortBahnTime
`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
*
S
hortBahnTime
`xml:"ts,attr,omitempty"`
Timestamp
*
s
hortBahnTime
`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
*
S
hortBahnTime
`xml:"ts,attr,omitempty"`
Timestamp
*
s
hortBahnTime
`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
*
S
hortBahnTime
`xml:"pt,attr,omitempty"`
PlannedTime
*
s
hortBahnTime
`xml:"pt,attr,omitempty"`
PlannedPath
*
B
ahnStringList
`xml:"ppth,attr,omitempty"`
PlannedPath
*
b
ahnStringList
`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
*
S
hortBahnTime
`xml:"ct,attr"`
ChangedTime
*
s
hortBahnTime
`xml:"ct,attr"`
ChangedPath
*
B
ahnStringList
`xml:"cpth,attr,omitempty"`
ChangedPath
*
b
ahnStringList
`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"`
...
...
This diff is collapsed.
Click to expand it.
types_util.go
+
40
−
40
View file @
4555ef85
...
@@ -7,9 +7,9 @@ import (
...
@@ -7,9 +7,9 @@ import (
"time"
"time"
)
)
type
B
ahnStringList
[]
string
type
b
ahnStringList
[]
string
func
(
s
*
B
ahnStringList
)
MarshalXMLAttr
(
name
xml
.
Name
)
(
xml
.
Attr
,
error
)
{
func
(
s
*
b
ahnStringList
)
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
*
B
ahnStringList
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
func
(
s
*
b
ahnStringList
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
*
s
=
strings
.
Split
(
attr
.
Value
,
"|"
)
*
s
=
strings
.
Split
(
attr
.
Value
,
"|"
)
return
nil
return
nil
}
}
func
(
s
*
B
ahnStringList
)
Value
()
[]
string
{
func
(
s
*
b
ahnStringList
)
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
B
ahnTime
struct
{
type
b
ahnTime
struct
{
time
.
Time
time
.
Time
}
}
const
B
ahnTimeLayout
=
"06-01-02 15:04:05.999"
const
b
ahnTimeLayout
=
"06-01-02 15:04:05.999"
func
(
t
*
B
ahnTime
)
MarshalXMLAttr
(
name
xml
.
Name
)
(
xml
.
Attr
,
error
)
{
func
(
t
*
b
ahnTime
)
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
(
B
ahnTimeLayout
),
Value
:
t
.
Format
(
b
ahnTimeLayout
),
},
nil
},
nil
}
}
}
}
func
(
t
*
B
ahnTime
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
func
(
t
*
b
ahnTime
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
if
attr
.
Value
!=
""
{
if
attr
.
Value
!=
""
{
value
,
err
:=
time
.
Parse
(
B
ahnTimeLayout
,
attr
.
Value
)
value
,
err
:=
time
.
Parse
(
b
ahnTimeLayout
,
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
*
B
ahnTime
)
Value
()
*
time
.
Time
{
func
(
t
*
b
ahnTime
)
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
S
hortBahnTime
struct
{
type
s
hortBahnTime
struct
{
time
.
Time
time
.
Time
}
}
const
S
hortBahnTimeLayout
=
"0601021504"
const
s
hortBahnTimeLayout
=
"0601021504"
func
(
t
*
S
hortBahnTime
)
MarshalXMLAttr
(
name
xml
.
Name
)
(
xml
.
Attr
,
error
)
{
func
(
t
*
s
hortBahnTime
)
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
(
S
hortBahnTimeLayout
),
Value
:
t
.
Format
(
s
hortBahnTimeLayout
),
},
nil
},
nil
}
}
}
}
func
(
t
*
S
hortBahnTime
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
func
(
t
*
s
hortBahnTime
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
if
attr
.
Value
!=
""
{
if
attr
.
Value
!=
""
{
value
,
err
:=
time
.
Parse
(
S
hortBahnTimeLayout
,
attr
.
Value
)
value
,
err
:=
time
.
Parse
(
s
hortBahnTimeLayout
,
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
*
S
hortBahnTime
)
Value
()
*
time
.
Time
{
func
(
t
*
s
hortBahnTime
)
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
M
ediumBahnTime
struct
{
type
m
ediumBahnTime
struct
{
time
.
Time
time
.
Time
}
}
const
M
ediumBahnTimeLayout
=
"2006-01-02T15:04:05"
const
m
ediumBahnTimeLayout
=
"2006-01-02T15:04:05"
func
(
t
*
M
ediumBahnTime
)
MarshalXMLAttr
(
name
xml
.
Name
)
(
xml
.
Attr
,
error
)
{
func
(
t
*
m
ediumBahnTime
)
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
(
M
ediumBahnTimeLayout
),
Value
:
t
.
Format
(
m
ediumBahnTimeLayout
),
},
nil
},
nil
}
}
}
}
func
(
t
*
M
ediumBahnTime
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
func
(
t
*
m
ediumBahnTime
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
if
attr
.
Value
!=
""
{
if
attr
.
Value
!=
""
{
value
,
err
:=
time
.
Parse
(
M
ediumBahnTimeLayout
,
attr
.
Value
)
value
,
err
:=
time
.
Parse
(
m
ediumBahnTimeLayout
,
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
*
M
ediumBahnTime
)
MarshalJSON
()
([]
byte
,
error
)
{
func
(
t
*
m
ediumBahnTime
)
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
(
M
ediumBahnTimeLayout
)
text
=
t
.
Format
(
m
ediumBahnTimeLayout
)
}
}
return
json
.
Marshal
(
&
text
)
return
json
.
Marshal
(
&
text
)
}
}
func
(
t
*
M
ediumBahnTime
)
UnmarshalJSON
(
data
[]
byte
)
error
{
func
(
t
*
m
ediumBahnTime
)
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
(
M
ediumBahnTimeLayout
,
text
);
err
!=
nil
{
if
value
,
err
=
time
.
Parse
(
m
ediumBahnTimeLayout
,
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
*
M
ediumBahnTime
)
Value
()
*
time
.
Time
{
func
(
t
*
m
ediumBahnTime
)
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
B
ahnDate
struct
{
type
b
ahnDate
struct
{
time
.
Time
time
.
Time
}
}
const
B
ahnDateLayout
=
"2006-01-02"
const
b
ahnDateLayout
=
"2006-01-02"
func
(
t
*
B
ahnDate
)
MarshalXMLAttr
(
name
xml
.
Name
)
(
xml
.
Attr
,
error
)
{
func
(
t
*
b
ahnDate
)
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
(
B
ahnDateLayout
),
Value
:
t
.
Format
(
b
ahnDateLayout
),
},
nil
},
nil
}
}
}
}
func
(
t
*
B
ahnDate
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
func
(
t
*
b
ahnDate
)
UnmarshalXMLAttr
(
attr
xml
.
Attr
)
error
{
if
attr
.
Value
!=
""
{
if
attr
.
Value
!=
""
{
value
,
err
:=
time
.
Parse
(
B
ahnDateLayout
,
attr
.
Value
)
value
,
err
:=
time
.
Parse
(
b
ahnDateLayout
,
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
*
B
ahnDate
)
MarshalJSON
()
([]
byte
,
error
)
{
func
(
t
*
b
ahnDate
)
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
(
B
ahnDateLayout
)
text
=
t
.
Format
(
b
ahnDateLayout
)
}
}
return
json
.
Marshal
(
&
text
)
return
json
.
Marshal
(
&
text
)
}
}
func
(
t
*
B
ahnDate
)
UnmarshalJSON
(
data
[]
byte
)
error
{
func
(
t
*
b
ahnDate
)
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
(
B
ahnDateLayout
,
text
);
err
!=
nil
{
if
value
,
err
=
time
.
Parse
(
b
ahnDateLayout
,
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
*
B
ahnDate
)
Value
()
*
time
.
Time
{
func
(
t
*
b
ahnDate
)
Value
()
*
time
.
Time
{
if
t
!=
nil
{
if
t
!=
nil
{
return
&
t
.
Time
return
&
t
.
Time
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment