This commit is contained in:
parent
d63d345a9b
commit
e48160dfa3
8 changed files with 243 additions and 390 deletions
40
internal/parsers/mandarake/handler.go
Normal file
40
internal/parsers/mandarake/handler.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package mandarake
|
||||
|
||||
import (
|
||||
"context"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
zeroPrice int32 = 0
|
||||
taxMultiplier float64 = 1.1
|
||||
logHeader = "Mandarake parser | "
|
||||
logWorker = "worker: "
|
||||
logTaskWarning = "task warning: "
|
||||
logGetPrice = "get price: "
|
||||
)
|
||||
|
||||
type Parser struct {
|
||||
baseCtx context.Context
|
||||
externalBrowser string
|
||||
goroutinesNumber int
|
||||
}
|
||||
|
||||
type ParserDeps struct {
|
||||
Enabled bool
|
||||
ExternalBrowser string
|
||||
GoroutinesNumber int
|
||||
}
|
||||
|
||||
func NewParser(deps ParserDeps) *Parser {
|
||||
if !deps.Enabled {
|
||||
log.Info(logHeader + "disabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
return &Parser{
|
||||
baseCtx: context.Background(),
|
||||
externalBrowser: deps.ExternalBrowser,
|
||||
goroutinesNumber: deps.GoroutinesNumber,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue