Skip to content

Make AbstractFunction available in more cases #197

Closed
@endink

Description

@endink

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 !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions