Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

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

Open
szyhf wants to merge 1 commit into
Knetic:masterfrom
szyhf:master
Open

add support to solve the field type implement Parameters.#120
szyhf wants to merge 1 commit into
Knetic:masterfrom
szyhf:master

Conversation

@szyhf

@szyhf szyhf commented Jan 19, 2019

Copy link
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants