Skip to content

Commit b6fefab

Browse files
committed
Add Name() method to Querier interface
1 parent 2f2312b commit b6fefab

35 files changed

Lines changed: 215 additions & 85 deletions

File tree

internal/alpine/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ type Client struct {
1111
HTTPClient *http.Client
1212
}
1313

14+
func (c Client) Name() string {
15+
return "Alpine"
16+
}
17+
1418
func (c Client) Query(query string) (bool, error) {
1519
url := fmt.Sprintf("https://pkgs.alpinelinux.org/packages?branch=edge&name=%s", query)
1620
contains, err := httputil.GetBodyContains(c.HTTPClient, url, "No matching packages found...")

internal/aosc/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ type Client struct {
1111
HTTPClient *http.Client
1212
}
1313

14+
func (c Client) Name() string {
15+
return "AOSC"
16+
}
17+
1418
func (c Client) Query(query string) (bool, error) {
1519
url := fmt.Sprintf("https://packages.aosc.io/packages/%s", query)
1620
return httputil.GetCheckOK(c.HTTPClient, url)

internal/archlinux/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ type Client struct {
1010
HTTPClient *http.Client
1111
}
1212

13+
func (c Client) Name() string {
14+
return "Arch"
15+
}
16+
1317
type responseBody struct {
1418
Results []json.RawMessage `json:"results"`
1519
}

internal/aur/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ type Client struct {
1010
HTTPClient *http.Client
1111
}
1212

13+
func (c Client) Name() string {
14+
return "AUR"
15+
}
16+
1317
type responseBody struct {
1418
ResultCount int `json:"resultcount"`
1519
}

internal/chocolatey/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ type Client struct {
1111
HTTPClient *http.Client
1212
}
1313

14+
func (c Client) Name() string {
15+
return "Chocolatey"
16+
}
17+
1418
func (c Client) Query(query string) (bool, error) {
1519
url := fmt.Sprintf("https://community.chocolatey.org/packages/%s", query)
1620
return httputil.GetCheckOK(c.HTTPClient, url)

internal/cran/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ type Client struct {
1111
HTTPClient *http.Client
1212
}
1313

14+
func (c Client) Name() string {
15+
return "CRAN"
16+
}
17+
1418
func (c Client) Query(query string) (bool, error) {
1519
url := fmt.Sprintf("https://crandb.r-pkg.org/%s", query)
1620
return httputil.GetCheckOK(c.HTTPClient, url)

internal/cratesio/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ type Client struct {
1111
HTTPClient *http.Client
1212
}
1313

14+
func (c Client) Name() string {
15+
return "crates.io"
16+
}
17+
1418
func (c Client) Query(query string) (bool, error) {
1519
url := fmt.Sprintf("https://crates.io/api/v1/crates/%s", query)
1620
return httputil.GetCheckOK(c.HTTPClient, url)

internal/debian/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ type Client struct {
1010
HTTPClient *http.Client
1111
}
1212

13+
func (c Client) Name() string {
14+
return "Debian"
15+
}
16+
1317
type responseBody struct {
1418
Error *json.RawMessage `json:"error"`
1519
}

internal/dub/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ type Client struct {
1111
HTTPClient *http.Client
1212
}
1313

14+
func (c Client) Name() string {
15+
return "DUB"
16+
}
17+
1418
func (c Client) Query(query string) (bool, error) {
1519
url := fmt.Sprintf("https://code.dlang.org/packages/%s", query)
1620
return httputil.GetCheckOK(c.HTTPClient, url)

internal/fedora/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ type Client struct {
1111
HTTPClient *http.Client
1212
}
1313

14+
func (c Client) Name() string {
15+
return "Fedora"
16+
}
17+
1418
func (c Client) Query(query string) (bool, error) {
1519
url := fmt.Sprintf("https://packages.fedoraproject.org/pkgs/%s", query)
1620
return httputil.GetCheckOK(c.HTTPClient, url)

0 commit comments

Comments
 (0)