carsrs

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

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:

  1. 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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL