Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 540 Bytes

README.md

File metadata and controls

42 lines (32 loc) · 540 Bytes

tailor

tailor returns only the map of the specified keys

install

go get github.com/wandercn/tailor

example

package main

import (
	"fmt"

	"github.com/wandercn/tailor"
)

func main() {
	doc := tailor.Object{
		"A": 1,
		"B": tailor.Object{
			"age": 20},
		"C": "c",
		"D": 0.99,
	}
	fmt.Printf("before: %v\n", doc)

	keys := []string{"C", "D"}
	result := tailor.ClipOne(keys, doc)

	fmt.Printf("after: %v\n", result)

}

result

before: map[A:1 B:map[age:20] C:c D:0.99]
after: map[C:c D:0.99]