variable

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package variable package is generate variable by object.

Index

Constants

This section is empty.

Variables

DefaultKindMarshalFuncs provides a default Kind conversion function.

View Source
var DefaultNameMarshalFuncs = map[string]VariableMarshalFunc{
	// contains filtered or unexported fields
}

DefaultNameMarshalFuncs define a default custom type conversion function

Functions

func Marshal

func Marshal(v interface{}) (v1alpha1.VariableList, error)

Marshal returns a list of variables based on v. use the default parameters of VariableMarshaller to call Marshal for processing.

func MarshalObjectReference

func MarshalObjectReference(st reflect.Type, base *field.Path, _ MarshalFuncManager) ([]v1alpha1.Variable, error)

MarshalObjectReference marshal the ObjectReference of k8s.io/api/core/v1 to variables.

func MarshalPointerToVariable

func MarshalPointerToVariable(st reflect.Type, base *field.Path, marshalFuncs MarshalFuncManager) ([]v1alpha1.Variable, error)

MarshalPointerToVariable marshal pointer to variable list.

func MarshalStructToVariable

func MarshalStructToVariable(st reflect.Type, base *field.Path, marshalFuncs MarshalFuncManager) (list []v1alpha1.Variable, err error)

MarshalStructToVariable marshal struct to variable list.

func MarshalSubject

func MarshalSubject(st reflect.Type, base *field.Path, _ MarshalFuncManager) ([]v1alpha1.Variable, error)

MarshalSubject marshal the Subject of k8s.io/api/rbac/v1 to variables.

func NewVariable

func NewVariable(field reflect.StructField, base *field.Path) *v1alpha1.Variable

NewVariable return variable from StructField.

Types

type MarshalFuncManager

type MarshalFuncManager interface {
	NameFuncs() map[string]VariableMarshalFunc
	KindFuncs() map[reflect.Kind]VariableMarshalFunc
}

MarshalFuncManager defines an interface for getting and returning conversion functions.

type VariableMarshalFunc

type VariableMarshalFunc func(reflect.Type, *field.Path, MarshalFuncManager) ([]v1alpha1.Variable, error)

VariableMarshalFunc define variable transformation function

type VariableMarshaller

type VariableMarshaller struct {
	NameMarshalFuncs map[string]VariableMarshalFunc
	KindMarshalFuncs map[reflect.Kind]VariableMarshalFunc

	Object interface{}
}

VariableMarshaller variable converter

func (*VariableMarshaller) KindFuncs

KindFuncs return kind convert funcs

func (*VariableMarshaller) Marshal

Marshal convert object to variable list.

func (*VariableMarshaller) NameFuncs

func (v *VariableMarshaller) NameFuncs() map[string]VariableMarshalFunc

NameFuncs return name convert funcs

Jump to

Keyboard shortcuts

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