Skip to content

Make AbstractFunction available in more cases #197

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

Closed
endink opened this issue May 10, 2020 · 0 comments · Fixed by #219
Closed

Make AbstractFunction available in more cases #197

endink opened this issue May 10, 2020 · 0 comments · Fixed by #219
Milestone

Comments

@endink
Copy link

endink commented May 10, 2020

Hope another AbstractFunction in dynamic sql can be improved in new release.

class AbstractFunction<T, U extends AbstractFunction<T, U>>

This generic constraint greatly limits AbstractFunction. Because it requires that the type of function returned has the same the type as incoming column.

consider mysql st_distance function, input type is point ( as byte array in Mybatis ), and return double, so AbstractFunction cant be used.

A simple solution to fix that is add a generic parameter and use inheritance to be compatible with existing code:


class ComputeFunction<TInput, TOutput, U extends AbstractFunction<TInput, TOutput, U>>


class AbstractFunction<T, U extends AbstractFunction<T, U>> : ComputeFunction<T, T, U extends ComputeFunction<T, T, U>>

thanks !

@jeffgbutler jeffgbutler transferred this issue from mybatis/generator May 10, 2020
@jeffgbutler jeffgbutler added this to the 1.1.5 milestone Jul 22, 2020
jeffgbutler added a commit to jeffgbutler/mybatis-dynamic-sql that referenced this issue Jul 22, 2020
jeffgbutler added a commit to jeffgbutler/mybatis-dynamic-sql that referenced this issue Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants