mock shops more spelled out
This commit is contained in:
@@ -10,22 +10,46 @@ type (
|
||||
)
|
||||
|
||||
const (
|
||||
Etsy Platform = "Etsy"
|
||||
Tiktok Platform = "Tiktok"
|
||||
Wix Platform = "Wix"
|
||||
Etsy Platform = "Etsy"
|
||||
Tiktok Platform = "Tiktok"
|
||||
Wix Platform = "Wix"
|
||||
Ebay Platform = "ebay"
|
||||
WalmartMarketplace Platform = "walmart_marketplace"
|
||||
Amazon Platform = "amazon"
|
||||
BigCartel Platform = "big_cartel"
|
||||
Ecwid Platform = "ecwid"
|
||||
Zoho Platform = "zoho"
|
||||
SquareOnline Platform = "square_online"
|
||||
Squarespace Platform = "squarespace"
|
||||
WooCommerce Platform = "woo_commerce"
|
||||
Shopify Platform = "shopify"
|
||||
)
|
||||
|
||||
var (
|
||||
allValues = []Platform{
|
||||
Etsy,
|
||||
Tiktok,
|
||||
Wix,
|
||||
Ebay,
|
||||
WalmartMarketplace,
|
||||
Amazon,
|
||||
BigCartel,
|
||||
Ecwid,
|
||||
Zoho,
|
||||
SquareOnline,
|
||||
Squarespace,
|
||||
WooCommerce,
|
||||
Shopify,
|
||||
}
|
||||
)
|
||||
|
||||
func NewPlatform(s string) (Platform, error) {
|
||||
switch strings.ToLower(s) {
|
||||
case strings.ToLower(string(Etsy)):
|
||||
return Etsy, nil
|
||||
case strings.ToLower(string(Tiktok)):
|
||||
return Tiktok, nil
|
||||
case strings.ToLower(string(Wix)):
|
||||
return Wix, nil
|
||||
default:
|
||||
return "", fmt.Errorf("unrecognized constant: %q", s)
|
||||
for _, v := range allValues {
|
||||
if strings.ToLower(s) == strings.ToLower(string(v)) {
|
||||
return v, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("unrecognized constant: %q", s)
|
||||
}
|
||||
|
||||
// sql.Scanner implementation
|
||||
|
||||
Reference in New Issue
Block a user