mapping

package
v0.0.0-...-c332a7c Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapObject

func MapObject(actionResolver MappingActionResolver, resultSet ResultSet, source interface{}) error

Types

type CompositeActionResolver

type CompositeActionResolver struct {
	Resolvers []MappingActionResolver
}

func ActionResolverComposedOf

func ActionResolverComposedOf(resolvers ...MappingActionResolver) *CompositeActionResolver

func (*CompositeActionResolver) ResolveMappingActions

func (r *CompositeActionResolver) ResolveMappingActions(source interface{}) ([]MappingAction, error)

type CompositeMappingAction

type CompositeMappingAction struct {
	Actions []MappingAction
}

func ActionComposedOf

func ActionComposedOf(actions ...MappingAction) *CompositeMappingAction

func (*CompositeMappingAction) Apply

func (a *CompositeMappingAction) Apply(source interface{}, resultSet ResultSet) error

type MappedResultSet

type MappedResultSet struct {
	// contains filtered or unexported fields
}

func NewMappedResultSet

func NewMappedResultSet() *MappedResultSet

func (*MappedResultSet) AddResult

func (m *MappedResultSet) AddResult(key string, result interface{})

func (*MappedResultSet) GetAllResults

func (m *MappedResultSet) GetAllResults() map[string]interface{}

func (*MappedResultSet) GetResult

func (m *MappedResultSet) GetResult(key string) (interface{}, bool)

type MappingAction

type MappingAction interface {
	// Apply performs the action to the result set using source
	Apply(source interface{}, resultSet ResultSet) error
}

MappingAction is the building block of the mapping process. Represents an individual action that updates the target resources

type MappingActionResolver

type MappingActionResolver interface {
	ResolveMappingActions(source interface{}) ([]MappingAction, error)
}

MappingActionResolver discovers MappingActions to be applied for a given source object

type ResultSet

type ResultSet interface {
	AddResult(key string, result interface{})
	GetResult(key string) (interface{}, bool)
	GetAllResults() map[string]interface{}
}

ResultSet manages the results being mapped

Directories

Path Synopsis
k8s

Jump to

Keyboard shortcuts

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