예제 #1
0
파일: encoding.go 프로젝트: cdupuis/strava
// MarshalJSON implements json.Marshaler for Leg. This encodes Go types back to
// the API representation.
func (leg *Leg) MarshalJSON() ([]byte, error) {
	x := encodedLeg{}
	x.safeLeg = safeLeg(*leg)

	x.EncDuration = internal.NewDuration(leg.Duration)
	x.EncDurationInTraffic = internal.NewDuration(leg.DurationInTraffic)
	x.EncArrivalTime = internal.NewDateTime(leg.ArrivalTime)
	x.EncDepartureTime = internal.NewDateTime(leg.DepartureTime)

	return json.Marshal(x)
}
예제 #2
0
파일: encoding.go 프로젝트: cdupuis/strava
// MarshalJSON implements json.Marshaler for Step. This encodes Go types back to
// the API representation.
func (step *Step) MarshalJSON() ([]byte, error) {
	x := encodedStep{}
	x.safeStep = safeStep(*step)

	x.EncDuration = internal.NewDuration(step.Duration)

	return json.Marshal(x)
}
예제 #3
0
파일: encoding.go 프로젝트: cdupuis/strava
// MarshalJSON implements json.Marshaler for DistanceMatrixElement. This encodes
// Go types back to the API representation.
func (dme *DistanceMatrixElement) MarshalJSON() ([]byte, error) {
	x := encodedDistanceMatrixElement{}
	x.safeDistanceMatrixElement = safeDistanceMatrixElement(*dme)

	x.EncDuration = internal.NewDuration(dme.Duration)

	return json.Marshal(x)
}