Skip to content

Commit

Permalink
实现枚举排序
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Sep 25, 2024
1 parent 82620aa commit 0b09834
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compareValue.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import (
// CompareLeftGreaterThanRight 比较两个值,左值是否大于右值
func CompareLeftGreaterThanRight(leftValue any, rightValue any) bool {
pointerMeta := fastReflect.PointerOf(leftValue)
if pointerMeta.IsEmum {
leftValue = parse.ToInt(leftValue)
rightValue = parse.ToInt(rightValue)
pointerMeta.Kind = reflect.Int
}
switch pointerMeta.Kind {
case reflect.Int8:
return rightValue.(int8) <= leftValue.(int8)
Expand Down

0 comments on commit 0b09834

Please sign in to comment.