This question already has an answer here:
I have an array/slice of members:
type SomeType struct {
timeStamp time
typeName string
other variables...
}
And there are 3 methods on this structure based on typeName, like:
isTypeA(): returns bool
isTypeB(): returns bool
isTypeC(): returns bool
Now this is how my sorting needs to work: - Sort based on timeStamp in ascending order - If the timeStamp is same, then typeA's should come before typeB's which should come before typeC's. (type A, B, C is not really alphabetical)
I am using sort.Slice to sort on timeStamp, but I am not sure how to do the type A,B,C sorting.
</div>