Documentation
¶
Index ¶
- Constants
- Variables
- type Job
- type JobData
- type JobRepository
- type Place
- type SelectParams
- type Server
- type Service
- func (s *Service) All(ctx context.Context) ([]Job, error)
- func (s *Service) Create(ctx context.Context, job *Job) error
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) Get(ctx context.Context, id string) (Job, error)
- func (s *Service) GetCSV(_ context.Context, id string) (string, error)
- func (s *Service) GetPlaces(_ context.Context, id string) ([]Place, error)
- func (s *Service) SelectPending(ctx context.Context) ([]Job, error)
- func (s *Service) Update(ctx context.Context, job *Job) error
Constants ¶
View Source
const ( StatusPending = "pending" StatusWorking = "working" StatusOK = "ok" StatusFailed = "failed" )
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrAlreadyExists = errors.New("already exists") )
View Source
var ErrPlacesNotFound = errors.New("places not found")
ErrPlacesNotFound is returned by GetPlaces when the job's CSV output does not exist. Callers use it to distinguish a missing job (404) from other errors.
Functions ¶
This section is empty.
Types ¶
type JobData ¶
type JobData struct {
Keywords []string `json:"keywords"`
Lang string `json:"lang"`
Zoom int `json:"zoom"`
Lat string `json:"lat"`
Lon string `json:"lon"`
FastMode bool `json:"fast_mode"`
Radius int `json:"radius"`
Depth int `json:"depth"`
Email bool `json:"email"`
ExtraReviews bool `json:"extra_reviews"`
MaxTime time.Duration `json:"max_time"`
Proxies []string `json:"proxies"`
}
type JobRepository ¶
type Place ¶ added in v1.17.2
type Place struct {
Title string `json:"title"`
Address string `json:"address"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Link string `json:"link"`
Category string `json:"category"`
Phone string `json:"phone"`
Website string `json:"website"`
ReviewRating float64 `json:"review_rating"`
}
Place is a single map-able result extracted from a job's CSV output.
type SelectParams ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo JobRepository, dataFolder string) *Service
Click to show internal directories.
Click to hide internal directories.