Skip to content

Using goverter:output:file as a comment prevents adding global extend settings #225

Description

@RangelReale

Is your feature request related to a problem? Please describe.
To be able to support direct assignment for stdlib types like 'time.Time', we need to add an extend setting with a function to a conversion function, which only does an assignment.

In my project, I have more than 100 resource types, like User, Device, Role, etc.

I want to use goverter for my payload-to-entity (and reverse) mapper, but having a single Converter interface with hundreds of methods isn't very maintanable. So I am creating one converter per-resource (UserConverter, DeviceConverter, RoleConverter), and each converter uses "output:file" to write to a separate file (user_gen.go, device_gen.go, role_gen.go).

All of these resources use stdlib types like time.Time, so I need to add goverter:extend ConvertTime in each one of them. Instead of this, I can add a global flag -g extend my-project/mapper:ConvertTime, so every converter include this setting.

But as each converter has a setting like goverter:output:file ./device_gen.go, and it is not possible to add an extend setting after an output one, it is impossible to use global extend arguments in CLI in this case.

Describe the solution you'd like
Because of the output setting limitation, there should be a way of setting flags which apply after the output ones, so this becomes possible to do.

Describe alternatives you've considered
Removing this limitation from output would be better, but seems to be much more complex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions