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

Is posible to reuse field resolver? Also is posible to set global resolver and use by name? #3186

Open
becash opened this issue Jul 17, 2024 · 0 comments

Comments

@becash
Copy link

becash commented Jul 17, 2024

type PresetDates {
edited(format: String): StringDate! @gofield(name:"DatetimeFormatResolver")
added(format: String): StringDate! @gofield(name:"DatetimeFormatResolver")
}
1 i have many fields where i need to convert some types, in that example i converting date to string, on each field automatically generate a resolver from where i call function that execute a logic , but i think it will be better if i can set somewhere a function directly, it reduce considedable a code, now i have in project arount a 100 same resolvers.

2 also if i set direct name of resolver ( to can reuse one ), it generate a few identical function, is normal?
example generated go interface ( also in resolver appear 2 identical function ):
type PresetDatesResolver interface {
DatetimeFormatResolver(ctx context.Context, obj *structure_999.PresetDates, input *domain.DatetimeFormat) (string, error)
DatetimeFormatResolver(ctx context.Context, obj *structure_999.PresetDates, input *domain.DatetimeFormat) (string, error)
}

3 Is posible to set a global resolver? for some conversion, and set that on field settings

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