sorts

package
v0.0.0-...-98a29f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DESC = "desc"
)

Variables

This section is empty.

Functions

func BinarySearch

func BinarySearch(slice []model.SliceItem, target string) (bool, int)

func RemoveDuplicates

func RemoveDuplicates(slice []model.SliceItem) []model.SliceItem

func UniqueFast

func UniqueFast(obj []model.SliceItem) []model.SliceItem

Types

type FastSort

type FastSort struct {
	sync.Mutex

	IsDebug bool

	Order string //排序方式
	// contains filtered or unexported fields
}

func (*FastSort) Add

func (f *FastSort) Add(ids *[]string)

func (*FastSort) Count

func (f *FastSort) Count() int

Count 获取数量

func (*FastSort) Get

func (f *FastSort) Get(start int) model.SliceItem

func (*FastSort) GetAll

func (f *FastSort) GetAll(result *[]model.SliceItem, start int, end int)

func (*FastSort) Process

func (f *FastSort) Process()

Process 处理数据

func (*FastSort) Sort

func (f *FastSort) Sort()

Sort 排序

type IdSort

type IdSort struct {
	Tree *avltree.Tree
	sync.Mutex
}

IdSort 二叉树对id 进行打分和排序

func NewIdSortTree

func NewIdSortTree() *IdSort

func (*IdSort) Add

func (e *IdSort) Add(key uint32)

func (*IdSort) GetAll

func (e *IdSort) GetAll(order string) []uint32

GetAll 正序获取

func (*IdSort) Size

func (e *IdSort) Size() int

type ScoreSlice

type ScoreSlice []model.SliceItem

func (ScoreSlice) Len

func (x ScoreSlice) Len() int

func (ScoreSlice) Less

func (x ScoreSlice) Less(i, j int) bool

func (ScoreSlice) Swap

func (x ScoreSlice) Swap(i, j int)

type SortSlice

type SortSlice []string

func (SortSlice) Len

func (x SortSlice) Len() int

func (SortSlice) Less

func (x SortSlice) Less(i, j int) bool

func (SortSlice) Swap

func (x SortSlice) Swap(i, j int)

type Uint32Slice

type Uint32Slice []uint32

func (Uint32Slice) Len

func (x Uint32Slice) Len() int

func (Uint32Slice) Less

func (x Uint32Slice) Less(i, j int) bool

func (Uint32Slice) Swap

func (x Uint32Slice) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL