dto

package
v0.0.0-...-01347ba Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	// Code is a unique code for the Endpoint. Doesn't have to be globally unique, just unique per service. For example,
	// "POST /locations" or "GET /locations/:id"
	Code *EndpointCode `json:"code"`
	// Name is a friendly name for the Endpoint. For example, "Create location" or "Get location by id"
	Name *EndpointName `json:"name"`
	// Dependencies is a map of Dependencies for a given Endpoint. Keys are service codes, values are lists of endpoint codes
	Dependencies *map[ServiceCode][]EndpointCode `json:"dependencies"`
}

Endpoint represents an Endpoint of a Service

type EndpointCode

type EndpointCode = string

EndpointCode is a code that uniquely identifies an Endpoint. It need not be globally unique, only unique within that one Service

type EndpointName

type EndpointName = string

EndpointName is the human-readable/friedly name of an Endpoint

type Service

type Service struct {
	// Code is a unique code for the service. For example, "location_tracking" for a location tracking service
	Code *ServiceCode `json:"code"`
	// Name is a friendly name for the service. For example, "Location Tracking" for a location tracking service
	Name *ServiceName `json:"name"`
	// Endpoints is a list of Endpoints that the Service has
	Endpoints *[]Endpoint `json:"endpoints"`
}

Service represents a service

func MakeServiceFromEntity

func MakeServiceFromEntity(s service.Service) Service

MakeServiceFromEntity constructs a Service DTO from a Service Entity

func MakeServiceFromRequest

func MakeServiceFromRequest(c *gin.Context) (Service, error)

MakeServiceFromRequest constructs a Service DTO from an HTTP request

func (*Service) ToEntity

func (s *Service) ToEntity() service.Service

ToEntity converts a Service DTO into a Service Entity

type ServiceCode

type ServiceCode = string

ServiceCode is a code that uniquely identifies a Service

type ServiceName

type ServiceName = string

ServiceName is the human-readable/friedly name of a Service

Jump to

Keyboard shortcuts

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