query

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 3 Imported by: 6

README

Greenbone Logo

Overview

This package and subpackages provide basic selector and response objects, including filter, paging and sorting

Subpackages:


query

import "github.com/greenbone/opensight-golang-libraries/pkg/query"

Index

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, totalRowCount uint64) Metadata

type ResponseListWithMetadata

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

License

Copyright (C) 2022-2023 [Greenbone AG][Greenbone AG]

Licensed under the GNU General Public License v3.0 or later.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterOption added in v1.0.2

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"`
}

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 Metadata

type Metadata struct {
	Filter  *filter.Request  `json:"filter,omitempty"`
	Paging  *paging.Response `json:"paging,omitempty"`
	Sorting *sorting.Request `json:"sorting,omitempty"`
}

Metadata represents the metadata used in a query.

func NewMetadata

func NewMetadata(resultSelector ResultSelector, totalRowCount uint64) Metadata

type ResponseListWithMetadata

type ResponseListWithMetadata[T any] struct {
	Metadata Metadata `json:"metadata" binding:"required"`
	Data     []T      `json:"data" binding:"required"`
}

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 ResponseWithMetadata

type ResponseWithMetadata[T any] struct {
	Metadata Metadata `json:"metadata" binding:"required"`
	Data     T        `json:"data" binding:"required"`
}

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 ResultSelector

type ResultSelector struct {
	Filter  *filter.Request  `json:"filter" binding:"omitempty"`
	Sorting *sorting.Request `json:"sorting" binding:"omitempty"`
	Paging  *paging.Request  `json:"paging" binding:"omitempty"`
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL