Extracted dict to Fetcher
This commit is contained in:
parent
1f69282c73
commit
4da8e94bcc
7 changed files with 22 additions and 19 deletions
32
internal/cardsinfo/card.go
Normal file
32
internal/cardsinfo/card.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package cardsinfo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CardPrice interface {
|
||||
Format() string
|
||||
}
|
||||
|
||||
type ScgCardPrice struct {
|
||||
Price string
|
||||
Edition string
|
||||
Link string
|
||||
}
|
||||
|
||||
func (s *ScgCardPrice) Format() string {
|
||||
return fmt.Sprintf("%v: %v\n%v\n", s.Edition, s.Price, s.Link)
|
||||
}
|
||||
|
||||
type Card struct {
|
||||
Name string `json:"name"`
|
||||
Layout string `json:"layout"`
|
||||
}
|
||||
|
||||
func (c *Card) getName() string {
|
||||
if c.Layout == "transform" {
|
||||
return strings.Replace(c.Name, "//", "|", 1)
|
||||
}
|
||||
return c.Name
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue