This package and subpackages provide basic selector and response objects, including filter, paging and sorting
Subpackages:
import "github.com/greenbone/opensight-golang-libraries/pkg/query"
- type FilterOption
- type Metadata
- type ResponseListWithMetadata
- type ResponseWithMetadata
- type ResultSelector
type FilterOption
FilterOption hold the information for a filter option. It can be used by a client to determine possible filters.
Name: The name of the option Control: The type of control for the option Operators: The list of comparison operators for the option Values: The possible values for the option MultiSelect: Indicates whether the option supports multiple selections
type FilterOption struct {
Name filter.ReadableValue[string] `json:"name" binding:"required"`
Control filter.RequestOptionType `json:"control" binding:"required"`
Operators []filter.ReadableValue[filter.CompareOperator] `json:"operators" binding:"required"`
Values []string `json:"values,omitempty"`
MultiSelect bool `json:"multiSelect" binding:"required"`
}
type Metadata
Metadata represents the metadata used in a query.
type Metadata struct {
Filter *filter.Request `json:"filter,omitempty"`
Paging *paging.Response `json:"paging,omitempty"`
Sorting *sorting.Request `json:"sorting,omitempty"`
}
func NewMetadata
func NewMetadata(resultSelector ResultSelector, totalResults uint64) Metadata
NewMetadata creates a new Metadata object based on the provided ResultSelector and totalResults.
func NewMetadataWithTotalResults(resultSelector ResultSelector, totalResults, resultLimit uint64) Metadata
NewMetadataWithTotalResults creates a new Metadata object based on the provided ResultSelector and totalResults.
ResponseListWithMetadata represents a response containing a list of data with associated metadata. The 'Metadata' field is of type 'Metadata' includes filter, paging, and sorting information used in the query. The 'Data' field is a slice of type 'T' and represents the data retrieved.
type ResponseListWithMetadata[T any] struct {
Metadata Metadata `json:"metadata" binding:"required"`
Data []T `json:"data" binding:"required"`
}
type ResponseWithMetadata
ResponseWithMetadata represents a response with associated metadata. The metadata includes filter, paging, and sorting information. The 'Metadata' field is of type 'Metadata' includes filter, paging, and sorting information used in the query. The 'Data' field is of any type and represents the data retrieved by the query.
type ResponseWithMetadata[T any] struct {
Metadata Metadata `json:"metadata" binding:"required"`
Data T `json:"data" binding:"required"`
}
type ResultSelector
ResultSelector is a type that represents the selection criteria for querying data. It contains a filter, sorting, and paging information. Filter is a pointer to a filter.Request struct that specifies the filtering criteria for the query. Sorting is a pointer to a sorting.Request struct that specifies the sorting order for the query. Paging is a pointer to a paging.Request struct that specifies the paging configuration for the query.
type ResultSelector struct {
Filter *filter.Request `json:"filter" binding:"omitempty"`
Sorting *sorting.Request `json:"sorting" binding:"omitempty"`
Paging *paging.Request `json:"paging" binding:"omitempty"`
}
Generated by gomarkdoc
Copyright (C) 2022-2023 [Greenbone AG][Greenbone AG]
Licensed under the GNU General Public License v3.0 or later.