carsrs

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 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(r *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/cars/:cid in order to ride or park a car.

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