Пример #1
0
func (service *telOFunService) createStation(soapStation SoapStation) station.Station {
	stationObject := station.Station{}

	stationObject.StationId = soapStation.Id
	stationObject.StationName = soapStation.EnglishName
	stationObject.Location = location.NewLocationFromString(soapStation.Latitude, soapStation.Longitude, soapStation.EnglishDescription)
	stationObject.Status = station.Status{soapStation.AvailableBike, soapStation.AvailableDocks}

	return stationObject
}
Пример #2
0
func (service *bicingService) createStation(bicingJsonStation bicingJsonStation) station.Station {

	stationObject := station.Station{}

	stationObject.StationId = bicingJsonStation.StationID
	stationObject.StationName = bicingJsonStation.StationName

	availableBikes, _ := strconv.ParseInt(bicingJsonStation.StationAvailableBikes, 10, 0)
	availableDocks, _ := strconv.ParseInt(bicingJsonStation.StationFreeSlot, 10, 0)

	stationObject.Status = station.Status{
		availableBikes,
		availableDocks,
	}

	stationObject.Location = location.NewLocationFromString(bicingJsonStation.Latitue, bicingJsonStation.Longitude, bicingJsonStation.StationName)

	return stationObject
}