rename

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: BSD-3-Clause Imports: 2 Imported by: 0

README

rename function

rename() will update the replace existing key names with new ones based on the provided configuration. It currently only works for top level fields (i.e. address.street would not work).

configuration
rename({"field_map": {"test":"renamed"}})
example

message in

{
    "_id": 0,
    "name": "transporter",
    "type": "function",
    "count": 10
}

config

rename({"field_map": {"count":"total"}})

message out

{
    "_id": 0,
    "name": "transporter",
    "type": "function",
    "total": 10
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rename

type Rename struct {
	SwapMap map[string]string `json:"field_map"`
}

Rename swaps out the field names based on the provided config

func (*Rename) Apply

func (r *Rename) Apply(msg message.Msg) (message.Msg, error)

Jump to

Keyboard shortcuts

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