Documentation ¶
Overview ¶
Package variable package is generate variable by object.
Index ¶
- Variables
- func Marshal(v interface{}) (v1alpha1.VariableList, error)
- func MarshalObjectReference(st reflect.Type, base *field.Path, _ MarshalFuncManager) ([]v1alpha1.Variable, error)
- func MarshalPointerToVariable(st reflect.Type, base *field.Path, marshalFuncs MarshalFuncManager) ([]v1alpha1.Variable, error)
- func MarshalStructToVariable(st reflect.Type, base *field.Path, marshalFuncs MarshalFuncManager) (list []v1alpha1.Variable, err error)
- func MarshalSubject(st reflect.Type, base *field.Path, _ MarshalFuncManager) ([]v1alpha1.Variable, error)
- func NewVariable(field reflect.StructField, base *field.Path) *v1alpha1.Variable
- type MarshalFuncManager
- type VariableMarshalFunc
- type VariableMarshaller
Constants ¶
This section is empty.
Variables ¶
var DefaultKindMarshalFuncs = map[reflect.Kind]VariableMarshalFunc{ reflect.Struct: MarshalStructToVariable, reflect.Pointer: MarshalPointerToVariable, }
DefaultKindMarshalFuncs provides a default Kind conversion function.
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 ¶
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 ¶
func (v *VariableMarshaller) KindFuncs() map[reflect.Kind]VariableMarshalFunc
KindFuncs return kind convert funcs
func (*VariableMarshaller) Marshal ¶
func (v *VariableMarshaller) Marshal() (v1alpha1.VariableList, error)
Marshal convert object to variable list.
func (*VariableMarshaller) NameFuncs ¶
func (v *VariableMarshaller) NameFuncs() map[string]VariableMarshalFunc
NameFuncs return name convert funcs