port

package
v0.0.0-...-f288741 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPortNotFound = errors.New("port not found")

Functions

This section is empty.

Types

type Port

type Port struct {
	Name        string    `json:"name"`
	City        string    `json:"city"`
	Country     string    `json:"country"`
	Alias       []string  `json:"alias"`
	Regions     []string  `json:"regions"`
	Coordinates []float64 `json:"coordinates"`
	Province    string    `json:"province"`
	Timezone    string    `json:"timezone"`
	Unlocs      []string  `json:"unlocs"`
	Code        string    `json:"code"`
}

type Repository

type Repository interface {
	RepositoryReader
	RepositoryWriter
}

Repository combines the reader and writer repository interfaces.

type RepositoryReader

type RepositoryReader interface {
	FindByUnLoc(ctx context.Context, unloc string) (*Port, error)
}

RepositoryReader has a list of methods that needs to be implemented by the repository for the reader interface.

type RepositoryWriter

type RepositoryWriter interface {
	Create(ctx context.Context, p *Port) error
	Update(ctx context.Context, p *Port) error
}

RepositoryWriter has a list of methods that needs to be implemented by the repository for the writer interface.

type Service

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

func NewService

func NewService(repo Repository) *Service

func (*Service) GetPortByUnLoc

func (s *Service) GetPortByUnLoc(ctx context.Context, unloc string) (*Port, error)

func (*Service) SavePort

func (s *Service) SavePort(ctx context.Context, p *Port) error

SavePort saves a port in the database or returns an error.

type UseCase

type UseCase interface {
	UseCaseReader
	UseCaseWriter
}

UseCase combines the reader and writer service interfaces.

type UseCaseReader

type UseCaseReader interface {
	GetPortByUnLoc(ctx context.Context, unloc string) (*Port, error)
}

UseCaseReader has a list of methods that needs to be implemented by the service for the reader interface.

type UseCaseWriter

type UseCaseWriter interface {
	SavePort(ctx context.Context, p *Port) error
}

UseCaseWriter has a list of methods that needs to be implemented by the service for the writer interface.

Jump to

Keyboard shortcuts

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