train

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchProcessor

type BatchProcessor interface {
	Run(ctx context.Context, key string, operation func(*Train)) error
}

BatchProcessor is an optional interface to decouple your code from `batch` package.

type ErrValidation

type ErrValidation string

func (ErrValidation) Error

func (e ErrValidation) Error() string

func (ErrValidation) Is

func (e ErrValidation) Is(err error) bool

type Service

type Service struct {
	BatchProcessor BatchProcessor
}

func (Service) Book

func (s Service) Book(ctx context.Context, trainName string, seatNumber int, person string) error

type Train

type Train struct {
	Seats []string
}

func New

func New(maxSeats int) *Train

func (*Train) Book

func (t *Train) Book(seatNumber int, person string) error

Jump to

Keyboard shortcuts

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