dcbot/internal/service/coords.go
Dawid Wysokiński a8f309c299
All checks were successful
continuous-integration/drone/push Build is passing
refactor: introduce adapters (#114)
Reviewed-on: #114
2023-07-03 06:23:32 +00:00

23 lines
490 B
Go

package service
import (
"context"
"gitea.dwysokinski.me/twhelp/dcbot/internal/domain"
)
type Coords struct {
twhelpSvc TWHelpService
}
func NewCoords(twhelpSvc TWHelpService) *Coords {
return &Coords{twhelpSvc: twhelpSvc}
}
func (c *Coords) Translate(ctx context.Context, version, server string, coords ...string) ([]domain.Village, error) {
if len(coords) == 0 {
return nil, nil
}
return c.twhelpSvc.ListVillagesCoords(ctx, version, server, coords, 0, int32(len(coords)))
}