1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-15 10:12:29 +08:00

experimental feature, algorithm/sorter.go try to implements sort function with go generics

This commit is contained in:
dudaodong
2022-01-14 17:01:44 +08:00
parent d46d12f949
commit 6f1feb96d6
5 changed files with 124 additions and 30 deletions

View File

@@ -0,0 +1,13 @@
// Copyright 2021 dudaodong@gmail.com. All rights reserved.
// Use of this source code is governed by MIT license
// Package lancetconstraints contain some comstomer constraints.
package lancetconstraints
// 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 interface{}) int
}