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

path for Interface{} #4

Open
xehrad opened this issue Aug 29, 2024 · 0 comments
Open

path for Interface{} #4

xehrad opened this issue Aug 29, 2024 · 0 comments

Comments

@xehrad
Copy link

xehrad commented Aug 29, 2024

When the field is an interface, can you cover this type of field for setting the value of the interface, for example:

type (
	StructI struct {
		FieldI interface{} `json:"fieldI"`
	}
	StructZ struct {
		Field0  bool         `json:"field0"`
		Field1  string       `json:"field1"`
	}
)

instance := &StructI{}
instance.FieldI = new(StructZ)
obj, _ := dot.New(instance)
obj.Insert("FieldI.Field0", true)
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

No branches or pull requests

1 participant