recordmap

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 8 Imported by: ? modules, 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 Apply

func Apply(records []map[string]interface{}, cfg Config, source string) []map[string]interface{}

func CopyRows

func CopyRows(records []map[string]interface{}) []map[string]interface{}

func Fields

func Fields(records []map[string]interface{}, keyField string) []string

func KeyField

func KeyField(cfg Config, source string) string

func Keyed

func Keyed(records []map[string]interface{}, keyField string, omitKey bool) map[string]interface{}

Types

type Config

type Config struct {
	Enabled     bool                   `json:"enabled" yaml:"enabled" toml:"enabled"`
	MappingFile string                 `json:"mapping_file,omitempty" yaml:"mapping_file,omitempty" toml:"mapping_file,omitempty"`
	KeyField    string                 `json:"key_field,omitempty" yaml:"key_field,omitempty" toml:"key_field,omitempty"`
	Fields      map[string]string      `json:"fields,omitempty" yaml:"fields,omitempty" toml:"fields,omitempty"`
	Values      map[string]ValueMap    `json:"values,omitempty" yaml:"values,omitempty" toml:"values,omitempty"`
	Defaults    map[string]interface{} `json:"defaults,omitempty" yaml:"defaults,omitempty" toml:"defaults,omitempty"`
	Include     []string               `json:"include,omitempty" yaml:"include,omitempty" toml:"include,omitempty"`
	Drop        []string               `json:"drop,omitempty" yaml:"drop,omitempty" toml:"drop,omitempty"`
	Numeric     map[string]NumericRule `json:"numeric,omitempty" yaml:"numeric,omitempty" toml:"numeric,omitempty"`
	Tables      map[string]TableConfig `json:"tables,omitempty" yaml:"tables,omitempty" toml:"tables,omitempty"`
}

Config describes optional key/value mapping and table-specific field rules. It is intentionally data-only so it can be embedded in JSON/YAML/TOML config files and reused by CLI, HTTP, WebSocket, and outbound sync paths.

func Effective

func Effective(cfg Config, source string) Config

func LoadFile

func LoadFile(path string) (Config, error)

LoadFile reads a mapping config from JSON. The main application config still supports YAML/TOML, but standalone mapping files are JSON so users can copy examples directly into other systems without format ambiguity.

func Merge

func Merge(base, overlay Config) Config

type NumericRule

type NumericRule struct {
	Multiplier float64 `json:"multiplier,omitempty" yaml:"multiplier,omitempty" toml:"multiplier,omitempty"`
	Add        float64 `json:"add,omitempty" yaml:"add,omitempty" toml:"add,omitempty"`
	Round      *int    `json:"round,omitempty" yaml:"round,omitempty" toml:"round,omitempty"`
}

type TableConfig

type TableConfig struct {
	Enabled  *bool                  `json:"enabled,omitempty" yaml:"enabled,omitempty" toml:"enabled,omitempty"`
	KeyField string                 `json:"key_field,omitempty" yaml:"key_field,omitempty" toml:"key_field,omitempty"`
	Fields   map[string]string      `json:"fields,omitempty" yaml:"fields,omitempty" toml:"fields,omitempty"`
	Values   map[string]ValueMap    `json:"values,omitempty" yaml:"values,omitempty" toml:"values,omitempty"`
	Defaults map[string]interface{} `json:"defaults,omitempty" yaml:"defaults,omitempty" toml:"defaults,omitempty"`
	Include  []string               `json:"include,omitempty" yaml:"include,omitempty" toml:"include,omitempty"`
	Drop     []string               `json:"drop,omitempty" yaml:"drop,omitempty" toml:"drop,omitempty"`
	Numeric  map[string]NumericRule `json:"numeric,omitempty" yaml:"numeric,omitempty" toml:"numeric,omitempty"`
}

type ValueMap

type ValueMap map[string]interface{}

Jump to

Keyboard shortcuts

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