transform

package
v0.0.0-...-e826753 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyCSVTransformations

func ApplyCSVTransformations(filePath string, rules CSVTransformationRules) ([]map[string]interface{}, error)

ApplyCSVTransformations applies all transformations to CSV data

func ApplyFirebaseTransformations

func ApplyFirebaseTransformations(data []map[string]interface{}, mapping MappingRules) []map[string]interface{}

func ApplyJSONTransformations

func ApplyJSONTransformations(data []map[string]interface{}, rules JSONTransformationRules) []map[string]interface{}

ApplyJSONTransformations applies all transformations to JSON data

func ApplyTransformations

func ApplyTransformations(data []map[string]string, rules TransformationRules) []map[string]string

ApplyTransformations applies all transformations to the data

func CSVToJSON

func CSVToJSON(data []map[string]interface{}) []byte

CSVToJSON converts a slice of map[string]interface{} (representing CSV data) into JSON format

Types

type AggregationRule

type AggregationRule struct {
	Operation string `yaml:"operation"`
	Column    string `yaml:"column"`
	As        string `yaml:"as"`
}

type CSVAggregationRule

type CSVAggregationRule struct {
	Operation string `yaml:"operation"`
	Column    string `yaml:"column"`
	As        string `yaml:"as"`
}

type CSVFilterRule

type CSVFilterRule struct {
	Column    string `yaml:"column"`
	Condition string `yaml:"condition"`
}

type CSVMappingRules

type CSVMappingRules struct {
	DynamicMapping bool `yaml:"dynamic_mapping"`
	CustomMapping  []struct {
		From string `yaml:"from"`
		To   string `yaml:"to"`
	} `yaml:"custom_mapping"`
}

type CSVTransformationRules

type CSVTransformationRules struct {
	Filter      []CSVFilterRule      `yaml:"filter"`
	Mapping     CSVMappingRules      `yaml:"mapping"`
	Aggregation []CSVAggregationRule `yaml:"aggregation"`
}

Define transformation rules structures for CSV

type FilterRule

type FilterRule struct {
	Column    string `yaml:"column"`
	Condition string `yaml:"condition"`
}

type JSONAggregationRule

type JSONAggregationRule struct {
	Operation string `yaml:"operation"`
	Key       string `yaml:"key"`
	As        string `yaml:"as"`
}

type JSONFilterRule

type JSONFilterRule struct {
	Key       string `yaml:"key"`
	Condition string `yaml:"condition"`
}

type JSONMappingRules

type JSONMappingRules struct {
	DynamicMapping bool `yaml:"dynamic_mapping"`
	CustomMapping  []struct {
		From string `yaml:"from"`
		To   string `yaml:"to"`
	} `yaml:"custom_mapping"`
}

type JSONTransformationRules

type JSONTransformationRules struct {
	Filter      []JSONFilterRule      `yaml:"filter"`
	Mapping     JSONMappingRules      `yaml:"mapping"`
	Aggregation []JSONAggregationRule `yaml:"aggregation"`
}

Define transformation rules structures for JSON

type MappingRules

type MappingRules struct {
	NameChange     string            `yaml:"name_change"`
	AddField       map[string]string `yaml:"add_field"`
	DynamicMapping bool              `yaml:"dynamic_mapping"`
}

type TransformationRules

type TransformationRules struct {
	Filter      []FilterRule      `yaml:"filter"`
	Mapping     MappingRules      `yaml:"mapping"`
	Aggregation []AggregationRule `yaml:"aggregation"`
}

Define transformation rules structures

Jump to

Keyboard shortcuts

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