ports

package
v0.0.0-...-80b0eab Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ports contains objects and services for Ports domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Port

type Port struct {
	ID          string
	Name        string
	City        string
	Country     string
	Alias       []string
	Regions     []string
	Coordinates []float64
	Province    string
	Timezone    string
	Unlocs      []string
	Code        string
}

Port is a domain entity.

func (Port) Validate

func (p Port) Validate() error

Validate checks if port's state is valid.

type Repository

type Repository interface {
	StorePort(context.Context, *Port) error
	ListPorts(context.Context) ([]Port, error)
}

Repository defines interface for storing Ports.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a service that allows to store and list Ports.

func NewService

func NewService(pr Repository) Service

NewService creates new Ports service.

func (Service) ListPorts

func (s Service) ListPorts(ctx context.Context) ([]Port, error)

ListPorts lists all Ports stored in the repository of the service.

func (Service) StorePort

func (s Service) StorePort(ctx context.Context, port *Port) error

StorePort stores given Port in a repository.

Jump to

Keyboard shortcuts

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