transformer

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Tracer trace.Tracer
}

Config holds transformer configuration

type Transformer

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

Transformer handles response transformations

func New

func New(cfg Config) *Transformer

New creates a new transformer instance

func (*Transformer) ApplyFiltering

func (t *Transformer) ApplyFiltering(data interface{}, allow, deny []string) interface{}

ApplyFiltering applies allow and deny filters to the data

func (*Transformer) ApplyMapping

func (t *Transformer) ApplyMapping(data interface{}, mapping map[string]string) interface{}

ApplyMapping renames fields according to the mapping configuration

func (*Transformer) ApplyTarget

func (t *Transformer) ApplyTarget(data interface{}, target string) interface{}

ApplyTarget extracts data from a nested target field

func (*Transformer) DeleteNestedField

func (t *Transformer) DeleteNestedField(data map[string]interface{}, field string)

DeleteNestedField deletes a nested field using dot notation

func (*Transformer) GetNestedField

func (t *Transformer) GetNestedField(data map[string]interface{}, field string) interface{}

GetNestedField gets a nested field using dot notation

func (*Transformer) SetNestedField

func (t *Transformer) SetNestedField(data map[string]interface{}, field string, value interface{})

SetNestedField sets a nested field using dot notation

func (*Transformer) Transform

func (t *Transformer) Transform(ctx context.Context, data interface{}, backend config.Backend) interface{}

Transform applies all transformations to a response based on backend configuration

Jump to

Keyboard shortcuts

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