Documentation ¶
Overview ¶
Package carsrs realizes the cars resource, allowing the cars manipulation REST APIs to be accepted and delegated to the cars use cases respectively.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(r1, r2 *gin.RouterGroup, cars func() *carsuc.UseCase)
Register instantiates a resource adapting the cars use case instance with the relevant REST APIs including:
- PATCH request to /api/caweb/(v1|v2)/cars/:cid in order to ride or park a car.
The same APIs are published as v1 and v2 RESTful endpoits.
Types ¶
type StrCoordinate ¶
type StrCoordinate struct { Lat string `form:"lat" binding:"required,latitude"` Lon string `form:"lon" binding:"required,longitude"` }
StrCoordinate is a string-based representation (instead of a numeric representation) of a geographical location.
func (StrCoordinate) ToModel ¶
func (sc StrCoordinate) ToModel() (c model.Coordinate, err error)
ToModel method converts a StrCoordinate to a model.Coordinate struct instance. Existence of this method allows all conversion codes to rely on exactly one implementation, so all fields should be listed here (and if some of them were missed after an update, fixing one place is enough to restore the whole project's sanity again).