xsort

package
v0.0.0-...-f89cf20 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 2 Imported by: 0

README

XSort

标准库中只有int, string, float64的排序功能,其他的虽然可以使用,但是使用到了反射,对性能有影响,因此诞生了该库。

sort.Interface 类型

package xsort

import (
    "github.com/leaxoy/x-go/types"
)

type ByteSlice types.ByteSlice
type UintSlice types.UintSlice
type Uint64Slice types.Uint64Slice
type Uint32Slice types.Uint32Slice
type Uint16Slice types.Uint16Slice
type Uint8Slice types.Uint8Slice
type IntSlice types.IntSlice
type Int64Slice types.Int64Slice
type Int32Slice types.Int32Slice
type Int16Slice types.Int16Slice
type Int8Slice types.Int8Slice
type StringSlice types.StringSlice
type Float64Slice types.Float64Slice
type Float32Slice types.Float32Slice
type ComparableSlice types.ComparableSlice

已上所有类型均实现了sort.Interface接口,可以直接进行sort操作

对所有类型的数据实现了sort.Search方法, 比如int,对应的search方法为func SearchInt(a []int, x int) int

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReverseInterface

func ReverseInterface(a []interface{}) []interface{}

func SearchComparable

func SearchComparable(a []types.Comparable, x types.Comparable) int

func SearchFloat32

func SearchFloat32(a []float32, x float32) int

func SearchFloat64

func SearchFloat64(a []float64, x float64) int

func SearchInt

func SearchInt(a []int, x int) int

func SearchInt16

func SearchInt16(a []int16, x int16) int

func SearchInt32

func SearchInt32(a []int32, x int32) int

func SearchInt64

func SearchInt64(a []int64, x int64) int

func SearchInt8

func SearchInt8(a []int8, x int8) int

func SearchString

func SearchString(a []string, x string) int

func SearchUint

func SearchUint(a []uint, x uint) int

func SearchUint16

func SearchUint16(a []uint16, x uint16) int

func SearchUint32

func SearchUint32(a []uint32, x uint32) int

func SearchUint64

func SearchUint64(a []uint64, x uint64) int

func SearchUint8

func SearchUint8(a []uint8, x uint8) int

Types

type ByteSlice

type ByteSlice types.ByteSlice

func (ByteSlice) Len

func (p ByteSlice) Len() int

func (ByteSlice) Less

func (p ByteSlice) Less(i, j int) bool

func (ByteSlice) Sort

func (p ByteSlice) Sort()

func (ByteSlice) Swap

func (p ByteSlice) Swap(i, j int)

type ComparableSlice

type ComparableSlice types.ComparableSlice

func (ComparableSlice) Len

func (p ComparableSlice) Len() int

func (ComparableSlice) Less

func (p ComparableSlice) Less(i, j int) bool

func (ComparableSlice) Sort

func (p ComparableSlice) Sort()

func (ComparableSlice) Swap

func (p ComparableSlice) Swap(i, j int)

type Float32Slice

type Float32Slice types.Float32Slice

func (Float32Slice) Len

func (p Float32Slice) Len() int

func (Float32Slice) Less

func (p Float32Slice) Less(i, j int) bool

func (Float32Slice) Sort

func (p Float32Slice) Sort()

func (Float32Slice) Swap

func (p Float32Slice) Swap(i, j int)

type Float64Slice

type Float64Slice types.Float64Slice

func (Float64Slice) Len

func (p Float64Slice) Len() int

func (Float64Slice) Less

func (p Float64Slice) Less(i, j int) bool

func (Float64Slice) Sort

func (p Float64Slice) Sort()

func (Float64Slice) Swap

func (p Float64Slice) Swap(i, j int)

type Int16Slice

type Int16Slice types.Int16Slice

func (Int16Slice) Len

func (p Int16Slice) Len() int

func (Int16Slice) Less

func (p Int16Slice) Less(i, j int) bool

func (Int16Slice) Sort

func (p Int16Slice) Sort()

func (Int16Slice) Swap

func (p Int16Slice) Swap(i, j int)

type Int32Slice

type Int32Slice types.Int32Slice

func (Int32Slice) Len

func (p Int32Slice) Len() int

func (Int32Slice) Less

func (p Int32Slice) Less(i, j int) bool

func (Int32Slice) Sort

func (p Int32Slice) Sort()

func (Int32Slice) Swap

func (p Int32Slice) Swap(i, j int)

type Int64Slice

type Int64Slice types.Int64Slice

func (Int64Slice) Len

func (p Int64Slice) Len() int

func (Int64Slice) Less

func (p Int64Slice) Less(i, j int) bool

func (Int64Slice) Sort

func (p Int64Slice) Sort()

func (Int64Slice) Swap

func (p Int64Slice) Swap(i, j int)

type Int8Slice

type Int8Slice types.Int8Slice

func (Int8Slice) Len

func (p Int8Slice) Len() int

func (Int8Slice) Less

func (p Int8Slice) Less(i, j int) bool

func (Int8Slice) Sort

func (p Int8Slice) Sort()

func (Int8Slice) Swap

func (p Int8Slice) Swap(i, j int)

type IntSlice

type IntSlice = sort.IntSlice

type StringSlice

type StringSlice types.StringSlice

func (StringSlice) Len

func (p StringSlice) Len() int

func (StringSlice) Less

func (p StringSlice) Less(i, j int) bool

func (StringSlice) Sort

func (p StringSlice) Sort()

func (StringSlice) Swap

func (p StringSlice) Swap(i, j int)

type Uint16Slice

type Uint16Slice types.Uint16Slice

func (Uint16Slice) Len

func (p Uint16Slice) Len() int

func (Uint16Slice) Less

func (p Uint16Slice) Less(i, j int) bool

func (Uint16Slice) Sort

func (p Uint16Slice) Sort()

func (Uint16Slice) Swap

func (p Uint16Slice) Swap(i, j int)

type Uint32Slice

type Uint32Slice types.Uint32Slice

func (Uint32Slice) Len

func (p Uint32Slice) Len() int

func (Uint32Slice) Less

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

func (Uint32Slice) Sort

func (p Uint32Slice) Sort()

func (Uint32Slice) Swap

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

type Uint64Slice

type Uint64Slice types.Uint64Slice

func (Uint64Slice) Len

func (p Uint64Slice) Len() int

func (Uint64Slice) Less

func (p Uint64Slice) Less(i, j int) bool

func (Uint64Slice) Sort

func (p Uint64Slice) Sort()

func (Uint64Slice) Swap

func (p Uint64Slice) Swap(i, j int)

type Uint8Slice

type Uint8Slice types.Uint8Slice

func (Uint8Slice) Len

func (p Uint8Slice) Len() int

func (Uint8Slice) Less

func (p Uint8Slice) Less(i, j int) bool

func (Uint8Slice) Sort

func (p Uint8Slice) Sort()

func (Uint8Slice) Swap

func (p Uint8Slice) Swap(i, j int)

type UintSlice

type UintSlice types.UintSlice

func (UintSlice) Len

func (p UintSlice) Len() int

func (UintSlice) Less

func (p UintSlice) Less(i, j int) bool

func (UintSlice) Sort

func (p UintSlice) Sort()

func (UintSlice) Swap

func (p UintSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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