wire icon indicating copy to clipboard operation
wire copied to clipboard

is wire.FieldsOf support any field ?

Open frankiezdh opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

A struct which is read from configuration file provide all its fields.

The sulotion now is wire.FieldsOf(new(*Cfg), "Field1", "Field2")

Describe the solution you'd like

wire.FieldsOf support any field, like wire.FieldsOf(new(*Cfg), "*")

Describe alternatives you've considered

The sulotion now is wire.FieldsOf(new(*Cfg), "Field1", "Field2")

Additional context

frankiezdh avatar Jul 20 '23 06:07 frankiezdh

Hi @frankiezdh, wire.FieldsOf(new(*Cfg), "Field1", "Field2") provides two return values, it would be really helpful if you could give an example code snippet of how you have used the return values.

ProgrammingMuffin avatar Dec 16 '23 03:12 ProgrammingMuffin

This is really useful , i made a fork and implemented the feature

https://github.com/osousa/drato

Be warned that if any type is previously injected or if types aren't unique, then it will complain. It still works as intended originally if passing the fieldnames

osousa avatar Jun 17 '24 23:06 osousa