Skip to content
/ tailor Public

tailor returns only the map of the specified keys

License

Notifications You must be signed in to change notification settings

obity/tailor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]

About

tailor returns only the map of the specified keys

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages