fields

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package fields defines and matches common struct fields.

Index

Constants

View Source
const (
	NameTypeMeta          = "TypeMeta"
	NameObjectMeta        = "ObjectMeta"
	NameListMeta          = "ListMeta"
	NameSpec              = "Spec"
	NameSpecTemplate      = "SpecTemplate"
	NameStatus            = "Status"
	NameResourceSpec      = "ResourceSpec"
	NameResourceStatus    = "ResourceStatus"
	NameNetworkNodeSpec   = "NetworkNodeSpec"
	NameNetworkNodeStatus = "NetworkNodeStatus"
	NameNetworkNodeUsage  = "NetworkNodeUsage"
	NameItems             = "Items"
)

Field names.

View Source
const (
	TypeSuffixTypeMeta          = "k8s.io/apimachinery/pkg/apis/meta/v1.TypeMeta"
	TypeSuffixObjectMeta        = "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"
	TypeSuffixListMeta          = "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"
	TypeSuffixSpec              = NameSpec
	TypeSuffixSpecTemplate      = NameSpecTemplate
	TypeSuffixStatus            = NameStatus
	TypeSuffixResourceSpec      = "github.com/yndd/ndd-runtime/apis/common/v1.ResourceSpec"
	TypeSuffixResourceStatus    = "github.com/yndd/ndd-runtime/apis/common/v1.ResourceStatus"
	TypeSuffixNetworkNodeSpec   = "github.com/yndd/ndd-runtime/apis/common/v1.NetworkNodeSpec"
	TypeSuffixNetworkNodeStatus = "github.com/yndd/ndd-runtime/apis/common/v1.NetworkNodeStatus"
	TypeSuffixNetworkNodeUsage  = "github.com/yndd/ndd-runtime/apis/common/v1.NetworkNodeUsage"
)

Field type suffixes.

Variables

This section is empty.

Functions

func Has

func Has(o types.Object, m ...Matcher) bool

Has returns true if the supplied Object's underlying type is struct (or a slice or map of struct), and it matches all of the supplied field Matchers.

Types

type Matcher

type Matcher func(f *types.Var) bool

A Matcher is a function that returns true if the supplied Var (assumed to be a struct field) matches its requirements.

func HasFieldThat

func HasFieldThat(m ...Matcher) Matcher

HasFieldThat returns a Matcher that returns true if the supplied field is a struct that matches the supplied field matchers.

func IsEmbedded

func IsEmbedded() Matcher

IsEmbedded returns a Matcher that returns true if the supplied field is embedded.

func IsItems

func IsItems() Matcher

IsItems returns a Matcher that returns true if the supplied field appears to be the Items of a Kubernetes list.

func IsListMeta

func IsListMeta() Matcher

IsListMeta returns a Matcher that returns true if the supplied field appears to be Kubernetes list metadata.

func IsNamed

func IsNamed(name string) Matcher

IsNamed returns a Matcher that returns true if the supplied field has the supplied name.

func IsNetworkNodeSpec

func IsNetworkNodeSpec() Matcher

IsNetworkNodeSpec returns a Matcher that returns true if the supplied field appears to be a ndd target config spec.

func IsNetworkNodeStatus

func IsNetworkNodeStatus() Matcher

IsNetworkNodeStatus returns a Matcher that returns true if the supplied field appears to be a ndd target config status.

func IsNetworkNodeUsage

func IsNetworkNodeUsage() Matcher

IsNetworkNodeUsage returns a Matcher that returns true if the supplied field appears to be a ndd target config usage.

func IsObjectMeta

func IsObjectMeta() Matcher

IsObjectMeta returns a Matcher that returns true if the supplied field appears to be Kubernetes object metadata.

func IsResourceSpec

func IsResourceSpec() Matcher

IsResourceSpec returns a Matcher that returns true if the supplied field appears to be a ndd managed resource spec.

func IsResourceStatus

func IsResourceStatus() Matcher

IsResourceStatus returns a Matcher that returns true if the supplied field appears to be a ndd managed resource status.

func IsSlice

func IsSlice() Matcher

IsSlice returns a Matcher that returns true if the supplied field is a slice.

func IsSpec

func IsSpec() Matcher

IsSpec returns a Matcher that returns true if the supplied field appears to be a Kubernetes resource spec.

func IsSpecTemplate

func IsSpecTemplate() Matcher

IsSpecTemplate returns a Matcher that returns true if the supplied field appears to be a ndd resource class spec template.

func IsStatus

func IsStatus() Matcher

IsStatus returns a Matcher that returns true if the supplied field appears to be a Kubernetes resource status.

func IsTypeMeta

func IsTypeMeta() Matcher

IsTypeMeta returns a Matcher that returns true if the supplied field appears to be Kubernetes type metadata.

func IsTypeNamed

func IsTypeNamed(typeNameSuffix, name string) Matcher

IsTypeNamed returns a Matcher that returns true if the supplied field has the supplied type name suffix and name.

func (Matcher) And

func (o Matcher) And(m Matcher) Matcher

And chains the original Matcher o with a new Matcher m.

Jump to

Keyboard shortcuts

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