Closed freakinhippie closed 4 years ago
I wonder if it's due to the fact that the type in MyType
is SemVer
, but the comparer interface is defined on *SemVer
.
You could try using &SemVer{} in your type and see if that works. I'll look into it as well.
Thanks,
It seems you're correct. I changed the type to *SemVer
and it is now calling my Compare
method. There is still a problem with the internals of the function, but that's not related to bolthold
.
Thank you!
I'm attempting to use the
FindAggregate()
method to get the maximum value for each group. My field uses a semantic version string. I've implemented a custom type to store the semantic version in an effort to leverage theComparer
interface since the default string comparison will not work properly for a semantic version. Unfortunately, it seems that theAggregateResult.Max()
method either doesn't use theComparer
interface, or I'm doing something wrong.Here is some example code to illustrate my attempted implementation.
I looked at
compare_test.go
to get an idea of how it is used and it doesn't have an example using theAggregateResult.Max()
. It did have an example using theQuery.Gt()
method so I tried using that just to see if myCompare()
method would log any output, but it did not.I'm open to refactoring my implementation. I just need to be able to use the
AggregateResult.*
methods on a semantic version string.