transform

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2025 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClusterTmplFuncs added in v0.5.3

func GetClusterTmplFuncs(cluster string) (template.FuncMap, bool)

func Patch

func Patch(original interface{}, patchText string) (interface{}, error)

Patch function applies a JSON patch to the original data structure.

func Register

func Register(tType string, transFunc TransformFunc)

Register function registers a transformation function with the given type.

func RegisterClusterTmplFunc added in v0.5.3

func RegisterClusterTmplFunc(cluster, funcName string, tmplFunc any) error

func Replace

func Replace(original interface{}, jsonString string) (interface{}, error)

Replace function replaces the original data structure with the new one derived from the JSON string.

Types

type TransformFunc

type TransformFunc func(original interface{}, transformText string) (target interface{}, err error)

TransformFunc is a type definition for transformation functions that take an original data structure and a transformation string, and return a transformed data structure and an error.

func GetTransformFunc

func GetTransformFunc(transformerType string) (TransformFunc, bool)

GetTransformFunc retrieves a registered transformation function by type.

type TransformFuncRegistry

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

TransformFuncRegistry is a struct that holds a map of transformation functions.

func NewRegistry

func NewRegistry() *TransformFuncRegistry

NewRegistry creates and returns a new instance of TransformFuncRegistry.

func (*TransformFuncRegistry) Get

func (r *TransformFuncRegistry) Get(transformerType string) (transFunc TransformFunc, found bool)

Get method of TransformFuncRegistry retrieves a registered transformation function by type.

func (*TransformFuncRegistry) Register

func (r *TransformFuncRegistry) Register(tType string, transFunc TransformFunc)

Register method of TransformFuncRegistry registers a transformation function with the given type.

Jump to

Keyboard shortcuts

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