mirror of
https://github.com/duke-git/lancet.git
synced 2025-09-26 19:41:20 +08:00
14 lines
464 B
Go
14 lines
464 B
Go
// Copyright 2021 dudaodong@gmail.com. All rights reserved.
|
|
// Use of this source code is governed by MIT license
|
|
|
|
// Package constraints contain some custom interface.
|
|
package constraints
|
|
|
|
// Comparator is for comparing two values
|
|
type Comparator interface {
|
|
// Compare v1 and v2
|
|
// Ascending order: should return 1 -> v1 > v2, 0 -> v1 = v2, -1 -> v1 < v2
|
|
// Descending order: should return 1 -> v1 < v2, 0 -> v1 = v2, -1 -> v1 > v2
|
|
Compare(v1, v2 any) int
|
|
}
|