0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00
zot/pkg/cli/client/gql_queries.go
Alexei Dodon f58597ade9
refactor: Reduce zli binary size (#1805)
Signed-off-by: Alexei Dodon <adodon@cisco.com>
2023-09-15 15:17:01 -07:00

116 lines
2.2 KiB
Go

//go:build search
// +build search
package client
type GQLField struct {
Name string
Type GQLType
}
type GQLType struct {
Name string
Fields []GQLField
}
type GQLQuery struct {
Name string
Args []string
ReturnType GQLType
}
func CVEResultForImage() GQLType {
return GQLType{
Name: "CVEResultForImage",
}
}
func PaginatedImagesResult() GQLType {
return GQLType{
Name: "PaginatedImagesResult",
}
}
func Referrer() GQLType {
return GQLType{
Name: "Referrer",
}
}
func GlobalSearchResult() GQLType {
return GQLType{
Name: "GlobalSearchResult",
}
}
func ImageListQuery() GQLQuery {
return GQLQuery{
Name: "ImageList",
Args: []string{"repo", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func ImageListForDigestQuery() GQLQuery {
return GQLQuery{
Name: "ImageListForDigest",
Args: []string{"id", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func BaseImageListQuery() GQLQuery {
return GQLQuery{
Name: "BaseImageList",
Args: []string{"image", "digest", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func DerivedImageListQuery() GQLQuery {
return GQLQuery{
Name: "DerivedImageList",
Args: []string{"image", "digest", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func CVEListForImageQuery() GQLQuery {
return GQLQuery{
Name: "CVEListForImage",
Args: []string{"image", "requestedPage", "searchedCVE"},
ReturnType: CVEResultForImage(),
}
}
func ImageListForCVEQuery() GQLQuery {
return GQLQuery{
Name: "ImageListForCVE",
Args: []string{"id", "filter", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func ImageListWithCVEFixedQuery() GQLQuery {
return GQLQuery{
Name: "ImageListWithCVEFixed",
Args: []string{"id", "image", "filter", "requestedPage"},
ReturnType: PaginatedImagesResult(),
}
}
func ReferrersQuery() GQLQuery {
return GQLQuery{
Name: "Referrers",
Args: []string{"repo", "digest", "type"},
ReturnType: Referrer(),
}
}
func GlobalSearchQuery() GQLQuery {
return GQLQuery{
Name: "GlobalSearch",
Args: []string{"query", "filter", "requestedPage"},
ReturnType: GlobalSearchResult(),
}
}