Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to solve the field type implement Parameters. #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szyhf
Copy link

@szyhf szyhf commented Jan 19, 2019

Hi, this library is awesome and really helps a lot.

But while I using I'm wondering to solve situation like some struct has a field of another Parameters, for example:

type DemoParams map[string]interface{}

func (d DemoParams) Get(s string) (interface{}, error) {
	v, ok := d[s]
	if ok {
		return v, nil
	}
	return nil, fmt.Errorf("%s not exist", s)
}

sharedParams := DemoParams{
	"A":  1,
	"B": 2,
	"C": DemoParams{
		"D": 3,
               "E": DemoParams{
		       "F": 4,
               },
	},
}

expr := "A + B + C.D + C.D.E.F"
// got "1+2+3+4"

So I made this PR, I tried to find the test of Parameters but failed, so if any place can I add test please let me know.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants