Skip to main content

metadata

metadata

import "github.com/cloudfoundry/go-cf-api/internal/apicommon/v3/metadata"

Index

Variables

var (
// All label tables should be the same so just pick a resource to get the column names from
guidColumn = models.Quote(models.AppColumns.GUID)
resourceGUIDColumn = models.Quote(models.AppLabelColumns.ResourceGUID)
keyColumn = models.Quote(models.AppLabelColumns.KeyName)
valueColumn = models.Quote(models.AppLabelColumns.Value)
)

func andIn

func andIn(field string, slice []string) qm.QueryMod

func subqueryBase

func subqueryBase(resourceTable, labelsTable string) []qm.QueryMod

func whereIn

func whereIn(field string, slice []Key) qm.QueryMod

type Key

type Key string

func (Key) isValid

func (k Key) isValid() bool

type LabelSelector

type LabelSelector struct {
Key Key
Operator Operator
Values []string
}

type LabelSelectorFilters

type LabelSelectorFilters interface {
Filters(resourceTable, labelsTable string) []qm.QueryMod
}

type LabelSelectorParser

type LabelSelectorParser interface {
Parse(labelSelector string) (LabelSelectorFilters, error)
}

func NewLabelSelectorParser

func NewLabelSelectorParser() LabelSelectorParser

type LabelSelectorSlice

type LabelSelectorSlice []LabelSelector

func (LabelSelectorSlice) Filters

func (selectors LabelSelectorSlice) Filters(resourceTable, labelsTable string) []qm.QueryMod

func (*LabelSelectorSlice) append

func (selectors *LabelSelectorSlice) append(key Key, operator Operator, values []string) error

type Map

type Map map[string]null.String

func getKeyValue

func getKeyValue(slice interface{}, keyField, valueField string) (keyValueMap Map, err error)

type Metadata

type Metadata struct {
Labels Map `json:"labels"`
Annotations Map `json:"annotations"`
}

func Get

func Get(annotationsSlice, labelsSlice interface{}) (Metadata, error)

type Operator

type Operator string
const (
Exists Operator = ""
NotExists Operator = "!"
Eq Operator = "="
EqAlt Operator = "=="
NotEq Operator = "!="
In Operator = "in"
NotIn Operator = "notin"

AllowedChars = "[[:alnum:]][[:alnum:]._-]*" // allow chars in keys: a-z,A-z,0-9,-,_,.
AllowedCharsWithComma = "[[:alnum:]][[:alnum:]._,-]*" // in clauses can contain commas

)

func (Operator) isValid

func (op Operator) isValid() bool

type exists

type exists []Key

func (exists) Filter

func (s exists) Filter(resourceTable, labelsTable string) qm.QueryMod

type inEquals

type inEquals struct {
in []LabelSelector
eq []LabelSelector
}

func (inEquals) Filter

func (s inEquals) Filter(resourceTable, labelsTable string) qm.QueryMod

func (inEquals) any

func (s inEquals) any() bool

type labelSelectorParser

type labelSelectorParser struct{}

func (*labelSelectorParser) Parse

func (l *labelSelectorParser) Parse(labelSelector string) (LabelSelectorFilters, error)

type notExists

type notExists []Key

func (notExists) Filter

func (s notExists) Filter(resourceTable, labelsTable string) qm.QueryMod

type notInEquals

type notInEquals struct {
notIn []LabelSelector
notEq []LabelSelector
}

func (notInEquals) Filter

func (s notInEquals) Filter(resourceTable, labelsTable string) qm.QueryMod

func (notInEquals) any

func (s notInEquals) any() bool

Generated by gomarkdoc