mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 12:28:01 +08:00
refactor: remove pkg/extensions/search/common and move the code to the appropriate packages (#1358)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
This commit is contained in:
+2
-1
@@ -10,6 +10,7 @@ import (
|
||||
distext "github.com/opencontainers/distribution-spec/specs-go/v1/extensions"
|
||||
|
||||
"zotregistry.io/zot/pkg/api/constants"
|
||||
"zotregistry.io/zot/pkg/common"
|
||||
)
|
||||
|
||||
type field struct {
|
||||
@@ -24,7 +25,7 @@ type schemaList struct {
|
||||
} `json:"queryType"` //nolint:tagliatelle // graphQL schema
|
||||
} `json:"__schema"` //nolint:tagliatelle // graphQL schema
|
||||
} `json:"data"`
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
}
|
||||
|
||||
func containsGQLQuery(queryList []field, query string) bool {
|
||||
|
||||
+11
-15
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
zotErrors "zotregistry.io/zot/errors"
|
||||
"zotregistry.io/zot/pkg/api/constants"
|
||||
"zotregistry.io/zot/pkg/common"
|
||||
)
|
||||
|
||||
type SearchService interface { //nolint:interfacebloat
|
||||
@@ -843,7 +844,7 @@ func (service searchService) makeGraphQLQuery(ctx context.Context,
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkResultGraphQLQuery(ctx context.Context, err error, resultErrors []errorGraphQL,
|
||||
func checkResultGraphQLQuery(ctx context.Context, err error, resultErrors []common.ErrorGraphQL,
|
||||
) error {
|
||||
if err != nil {
|
||||
if isContextDone(ctx) {
|
||||
@@ -899,13 +900,8 @@ func addManifestCallToPool(ctx context.Context, config searchConfig, pool *reque
|
||||
}
|
||||
|
||||
type cveResult struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Data cveData `json:"data"`
|
||||
}
|
||||
|
||||
type errorGraphQL struct {
|
||||
Message string `json:"message"`
|
||||
Path []string `json:"path"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
Data cveData `json:"data"`
|
||||
}
|
||||
|
||||
type tagListResp struct {
|
||||
@@ -996,14 +992,14 @@ func (cve cveResult) stringYAML() (string, error) {
|
||||
}
|
||||
|
||||
type fixedTags struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
PaginatedImagesResult `json:"ImageListWithCVEFixed"` //nolint:tagliatelle // graphQL schema
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type imagesForCve struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
PaginatedImagesResult `json:"ImageListForCVE"` //nolint:tagliatelle // graphQL schema
|
||||
} `json:"data"`
|
||||
@@ -1047,35 +1043,35 @@ type BaseImageList struct {
|
||||
}
|
||||
|
||||
type imageListStructGQL struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
PaginatedImagesResult `json:"ImageList"` //nolint:tagliatelle
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type imageListStructForDigestGQL struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
PaginatedImagesResult `json:"ImageListForDigest"` //nolint:tagliatelle
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type imageListStructForDerivedImagesGQL struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
PaginatedImagesResult `json:"DerivedImageList"` //nolint:tagliatelle
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type imageListStructForBaseImagesGQL struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
PaginatedImagesResult `json:"BaseImageList"` //nolint:tagliatelle
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type imagesForDigest struct {
|
||||
Errors []errorGraphQL `json:"errors"`
|
||||
Errors []common.ErrorGraphQL `json:"errors"`
|
||||
Data struct {
|
||||
PaginatedImagesResult `json:"ImageListForDigest"` //nolint:tagliatelle // graphQL schema
|
||||
} `json:"data"`
|
||||
|
||||
Reference in New Issue
Block a user