github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/columns/types.go (about) 1 // Copyright 2022 The Inspektor Gadget authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package columns 16 17 // Alignment defines whether text should be aligned to the left or right inside a column 18 type Alignment int 19 20 const ( 21 AlignLeft Alignment = iota 22 AlignRight 23 ) 24 25 // GroupType defines how columns should be aggregated in case of grouping 26 type GroupType int 27 28 const ( 29 GroupTypeNone GroupType = iota // GroupTypeNone uses the first occurrence of a value in a group to represent its group 30 GroupTypeSum // GroupTypeSum adds values of this column up for its group 31 ) 32 33 // Order defines the sorting order of columns 34 type Order bool 35 36 const ( 37 OrderAsc Order = true // OrderAsc sorts in ascending alphanumerical order 38 OrderDesc Order = false // OrderDesc sorts in descending alphanumerical order 39 ) 40 41 type ColumnMatcher interface { 42 HasTag(string) bool 43 HasNoTags() bool 44 IsEmbedded() bool 45 } 46 47 // ColumnInterface is an interface that is valid for Columns and ColumnMap 48 type ColumnInterface[T any] interface { 49 GetColumn(columnName string) (*Column[T], bool) 50 GetColumnMap(filters ...ColumnFilter) ColumnMap[T] 51 GetOrderedColumns(filters ...ColumnFilter) []*Column[T] 52 GetColumnNames(filters ...ColumnFilter) []string 53 }