params

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPage     int32 = 1
	DefaultPageSize int32 = 25
)
View Source
const (
	DefaultSortFieldForServiceGroups = "name"
	DefaultSortFieldForServices      = "health"
	DefaultSortAscending             = true

	// Define here your sort fields
	DefaultField SortField = iota
	PercentOkField
	NameField
	HealthField
)

Variables

This section is empty.

Functions

func FormatFilters

func FormatFilters(filters []string) (map[string][]string, error)

FormatFilters Will receive an array of filters and will format them into a map of strings

Example:

[
 "status:critical",
 "service_name:redis",
 "service_name:postgres",
 "application:cafe",
 "environment:prod",
]

The returned filters would look like:

map[string][]string [

"status": ["critical"],
"service_name": ["redis","postgres"],
"application": ["cafe"],
"environment": ["prod"]

] TODO: (afiune) Migrate this to a common go package that other teams can consume

func GetPageParams

func GetPageParams(p *query.Pagination) (int32, int32)

func GetSortParamsForServiceGroups

func GetSortParamsForServiceGroups(s *query.Sorting) (sortField string, sortAsc bool, err error)

GetSortParamsForServiceGroups returns valid sorting parameters for service_groups from the sort query

func GetSortParamsForServices

func GetSortParamsForServices(s *query.Sorting) (sortField string, sortAsc bool, err error)

GetSortParamsForServices returns valid sorting parameters for services from the sort query

Types

type SortField

type SortField int

SortField defines our valid sorting fields

Jump to

Keyboard shortcuts

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