slice

package
v0.0.0-...-86643de Latest Latest
Warning

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

Go to latest
Published: May 10, 2019 License: BSD-2-Clause Imports: 2 Imported by: 0

README

slice

Slice provides lovely helpful slice methods for Go

  • This project is in its very early stages, and will be built out as needed.

Documentation

Overview

Slice provides high-performance slice management utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonStrings

func CommonStrings(s1, s2 []string) []string

CommonStrings gets a new []string that contains strings that are present in both specified slices.

func Contains

func Contains(slice, contains interface{}) bool

Contains determines if the "contains" argument is contained within the "slice" argument. The slice argument must be a slice or array.

This function is performant for builtin types such as int, string, etc, though it is not quite as fast as a direct comparison loop would be, due to some type assertion necessary to make it generic.

If the type passed is not a builtin type, it is significantly slower due to deep equality checks.

This function is practically equal in performance to a a direct comparison loop for large arrays as the type assertion becomes a miniscule part of the overall time spent. For small arrays, it is about 7 times slower than using the equivalent direct call function.

If you need bleeding edge performance, use one of the direct functions provided.

func ContainsBool

func ContainsBool(slice []bool, contains bool) bool

ContainsBool checks if the slice has the contains value in it.

func ContainsComplex128

func ContainsComplex128(slice []complex128, contains complex128) bool

ContainsComplex128 checks if the slice has the contains value in it.

func ContainsComplex64

func ContainsComplex64(slice []complex64, contains complex64) bool

ContainsComplex64 checks if the slice has the contains value in it.

func ContainsFloat32

func ContainsFloat32(slice []float32, contains float32) bool

ContainsFloat32 checks if the slice has the contains value in it.

func ContainsFloat64

func ContainsFloat64(slice []float64, contains float64) bool

ContainsFloat64 checks if the slice has the contains value in it.

func ContainsInt

func ContainsInt(slice []int, contains int) bool

ContainsInt checks if the slice has the contains value in it.

func ContainsInt16

func ContainsInt16(slice []int16, contains int16) bool

ContainsInt16 checks if the slice has the contains value in it.

func ContainsInt32

func ContainsInt32(slice []int32, contains int32) bool

ContainsInt32 checks if the slice has the contains value in it.

func ContainsInt64

func ContainsInt64(slice []int64, contains int64) bool

ContainsInt64 checks if the slice has the contains value in it.

func ContainsInt8

func ContainsInt8(slice []int8, contains int8) bool

ContainsInt8 checks if the slice has the contains value in it.

func ContainsObject

func ContainsObject(slice interface{}, contains interface{}) bool

ContainsObject checks if the slice has the contains value in it.

func ContainsString

func ContainsString(slice []string, contains string) bool

ContainsString checks if the slice has the contains value in it.

func ContainsUInt

func ContainsUInt(slice []uint, contains uint) bool

ContainsUInt checks if the slice has the contains value in it.

func ContainsUInt16

func ContainsUInt16(slice []uint16, contains uint16) bool

ContainsUInt16 checks if the slice has the contains value in it.

func ContainsUInt32

func ContainsUInt32(slice []uint32, contains uint32) bool

ContainsUInt32 checks if the slice has the contains value in it.

func ContainsUInt64

func ContainsUInt64(slice []uint64, contains uint64) bool

ContainsUInt64 checks if the slice has the contains value in it.

func ContainsUInt8

func ContainsUInt8(slice []uint8, contains uint8) bool

ContainsUInt8 checks if the slice has the contains value in it.

func MinusStrings

func MinusStrings(s, minus []string) []string

MinusStrings gets a new []string containing all items in s, that no not appear in minus.

func PlusStrings

func PlusStrings(s, plus []string) []string

PlusStrings adds two []string arrays together, returning a new []string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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