slices

package
v2.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

Package slices contains functions to operate on slices treated as sets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToStrings

func BytesToStrings(a [][]byte) []string

BytesToStrings converts a slice of []byte into a slice of strings.

func CompareSlice

func CompareSlice(a, b [][]byte) int

CompareSlice returns an integer comparing two slices of byte slices lexicographically. The result will be 0 if a==b, -1 if a < b, and +1 if a > b.

func CopyChunkedByteSlices

func CopyChunkedByteSlices(src [][]byte, chunkSize int) [][]byte

CopyChunkedByteSlices deep-copies a [][]byte to a new [][]byte that is backed by a small number of []byte "chunks".

func Exists

func Exists(set []string, find string) bool

Exists checks if a string is in a set.

func ExistsIgnoreCase

func ExistsIgnoreCase(set []string, find string) bool

ExistsIgnoreCase checks if a string is in a set but ignores its case.

func MergeSortedBytes

func MergeSortedBytes(n ...[][]byte) [][]byte

Merge uses a k-way merge to merge n collections of sorted byte slices.

The resulting slice is returned in ascending order, with any duplicate values removed.

func MergeSortedFloats

func MergeSortedFloats(n ...[]float64) []float64

Merge uses a k-way merge to merge n collections of sorted byte slices.

The resulting slice is returned in ascending order, with any duplicate values removed.

func MergeSortedInts

func MergeSortedInts(n ...[]int64) []int64

Merge uses a k-way merge to merge n collections of sorted byte slices.

The resulting slice is returned in ascending order, with any duplicate values removed.

func MergeSortedStrings

func MergeSortedStrings(n ...[]string) []string

Merge uses a k-way merge to merge n collections of sorted byte slices.

The resulting slice is returned in ascending order, with any duplicate values removed.

func MergeSortedUInts

func MergeSortedUInts(n ...[]uint64) []uint64

Merge uses a k-way merge to merge n collections of sorted byte slices.

The resulting slice is returned in ascending order, with any duplicate values removed.

func StringsToBytes

func StringsToBytes(s ...string) [][]byte

StringsToBytes converts a variable number of strings into a slice of []byte.

func Union

func Union(setA, setB []string, ignoreCase bool) []string

Union combines two string sets.

Types

This section is empty.

Jump to

Keyboard shortcuts

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