slicer

package module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 3 Imported by: 61

README

Utility class for handling slices.

Go Report Card GoDoc CodeFactor codecov Mentioned in Awesome Go

Install

go get -u github.com/leaanthony/slicer

Quick Start

  import "github.com/leaanthony/slicer"

  func test() {
    s := slicer.String()
    s.Add("one")
    s.Add("two")
    s.AddSlice([]string{"three","four"})
    fmt.Printf("My slice = %+v\n", s.AsSlice())
    
    t := slicer.String()
    t.Add("zero")
    t.AddSlicer(s)
    fmt.Printf("My slice = %+v\n", t.AsSlice())
  }

Available slicers

  • Int
  • Int8
  • Int16
  • Int32
  • Int64
  • UInt
  • UInt8
  • UInt16
  • UInt32
  • UInt64
  • Float32
  • Float64
  • String
  • Bool
  • Interface

API

Construction

Create new Slicers by calling one of the following functions:

  • Int()
  • Int8()
  • Int16()
  • Int32()
  • Int64()
  • Float32()
  • Float64()
  • String()
  • Bool()
  • Interface()
  s := slicer.String()

If you wish to convert an existing slice to a Slicer, you may pass it in during creation:

  values := []string{"one", "two", "three"}
  s := slicer.String(values)

Add

Adds a value to the slice.

  values := []string{"one", "two", "three"}
  s := slicer.String(values)
  s.Add("four")

AddUnique

Adds a value to the slice if it doesn't already contain it.

  values := []string{"one", "two", "three", "one", "two", "three"}
  s := slicer.String(values)
  result := s.Join(",")
  // result is "one,two,three"

AddSlice

Adds an existing slice of values to a slicer

  s := slicer.String([]string{"one"})
  s.AddSlice([]string{"two"})

AsSlice

Returns a regular slice from the slicer.

  s := slicer.String([]string{"one"})
  for _, value := range s.AsSlice() {
    ...
  }

AddSlicer

Adds an existing slicer of values to another slicer

  a := slicer.String([]string{"one"})
  b := slicer.String([]string{"two"})
  a.AddSlicer(b)

Filter

Filter the values of a slicer based on the result of calling the given function with each value of the slice. If it returns true, the value is added to the result.

  a := slicer.Int([]int{1,5,7,9,6,3,1,9,1})
  result := a.Filter(func(v int) bool {
    return v > 5
  })
  // result is []int{7,9,9}
  

Each

Each iterates over all the values of a slicer, passing them in as paramter to a function

  a := slicer.Int([]int{1,5,7,9,6,3,1,9,1})
  result := 0
  a.Each(func(v int) {
    result += v
  })
  // result is 42

Contains

Contains returns true if the slicer contains the given value

  a := slicer.Int([]int{1,5,7,9,6,3,1,9,1})
  result := a.Contains(9)
  // result is True

Join

Returns a string with the slicer elements separated by the given separator

  a := slicer.String([]string{"one", "two", "three"})
  result := a.Join(",")
  // result is "one,two,three"

Length

Returns the length of the slice

  a := slicer.String([]string{"one", "two", "three"})
  result := a.Length()
  // result is 3

Clear

Clears all elements from the current slice

  a := slicer.String([]string{"one", "two", "three"})
  a.Clear()
  // a.Length() == 0

Sort

Sorts the elements of a slice Not supported by: InterfaceSlicer, BoolSlicer

  a := slicer.Int([]int{5,3,4,1,2})
  a.Sort()
  // a is []int{1,2,3,4,5}

Deduplicate

Deduplicate removes all duplicates within a slice.

  a := slicer.Int([]int{5,3,5,1,3})
  a.Deduplicate()
  // a is []int{5,3,1}

Documentation

Overview

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Package slicer contains utility classes for handling slices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolSlicer

type BoolSlicer struct {
	// contains filtered or unexported fields
}

BoolSlicer handles slices of bool

func Bool

func Bool(slice ...[]bool) *BoolSlicer

Bool creates a new BoolSlicer

func (*BoolSlicer) Add

func (s *BoolSlicer) Add(value bool, additional ...bool)

Add a bool value to the slicer

func (*BoolSlicer) AddSlice

func (s *BoolSlicer) AddSlice(value []bool)

AddSlice adds a bool slice to the slicer

func (*BoolSlicer) AddSlicer

func (s *BoolSlicer) AddSlicer(value *BoolSlicer)

AddSlicer appends a BoolSlicer to the slicer

func (*BoolSlicer) AddUnique added in v1.5.0

func (s *BoolSlicer) AddUnique(value bool, additional ...bool)

AddUnique adds a bool value to the slicer if it does not already exist

func (*BoolSlicer) AsSlice

func (s *BoolSlicer) AsSlice() []bool

AsSlice returns the slice

func (*BoolSlicer) Clear added in v1.3.4

func (s *BoolSlicer) Clear()

Clear all elements in the slice

func (*BoolSlicer) Contains added in v1.3.3

func (s *BoolSlicer) Contains(matcher bool) bool

Contains indicates if the given value is in the slice

func (*BoolSlicer) Deduplicate added in v1.4.1

func (s *BoolSlicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*BoolSlicer) Each added in v1.2.0

func (s *BoolSlicer) Each(fn func(bool))

Each runs a function on every element of the slice

func (*BoolSlicer) Filter added in v1.1.0

func (s *BoolSlicer) Filter(fn func(bool) bool) *BoolSlicer

Filter the slice based on the given function

func (*BoolSlicer) Join added in v1.3.4

func (s *BoolSlicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*BoolSlicer) Length added in v1.3.4

func (s *BoolSlicer) Length() int

Length returns the number of elements in the slice

type Float32Slicer

type Float32Slicer struct {
	// contains filtered or unexported fields
}

Float32Slicer handles slices of float32

func Float32

func Float32(slice ...[]float32) *Float32Slicer

Float32 creates a new Float32Slicer

func (*Float32Slicer) Add

func (s *Float32Slicer) Add(value float32, additional ...float32)

Add a float32 value to the slicer

func (*Float32Slicer) AddSlice

func (s *Float32Slicer) AddSlice(value []float32)

AddSlice adds a float32 slice to the slicer

func (*Float32Slicer) AddSlicer

func (s *Float32Slicer) AddSlicer(value *Float32Slicer)

AddSlicer appends a Float32Slicer to the slicer

func (*Float32Slicer) AddUnique added in v1.5.0

func (s *Float32Slicer) AddUnique(value float32, additional ...float32)

AddUnique adds a float32 value to the slicer if it does not already exist

func (*Float32Slicer) AsSlice

func (s *Float32Slicer) AsSlice() []float32

AsSlice returns the slice

func (*Float32Slicer) Clear added in v1.3.4

func (s *Float32Slicer) Clear()

Clear all elements in the slice

func (*Float32Slicer) Contains added in v1.3.3

func (s *Float32Slicer) Contains(matcher float32) bool

Contains indicates if the given value is in the slice

func (*Float32Slicer) Deduplicate added in v1.4.1

func (s *Float32Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Float32Slicer) Each added in v1.2.0

func (s *Float32Slicer) Each(fn func(float32))

Each runs a function on every element of the slice

func (*Float32Slicer) Filter added in v1.1.0

func (s *Float32Slicer) Filter(fn func(float32) bool) *Float32Slicer

Filter the slice based on the given function

func (*Float32Slicer) Join added in v1.3.4

func (s *Float32Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Float32Slicer) Length added in v1.3.4

func (s *Float32Slicer) Length() int

Length returns the number of elements in the slice

func (*Float32Slicer) Sort added in v1.4.0

func (s *Float32Slicer) Sort()

Sort the slice values

type Float64Slicer

type Float64Slicer struct {
	// contains filtered or unexported fields
}

Float64Slicer handles slices of float64

func Float64

func Float64(slice ...[]float64) *Float64Slicer

Float64 creates a new Float64Slicer

func (*Float64Slicer) Add

func (s *Float64Slicer) Add(value float64, additional ...float64)

Add a float64 value to the slicer

func (*Float64Slicer) AddSlice

func (s *Float64Slicer) AddSlice(value []float64)

AddSlice adds a float64 slice to the slicer

func (*Float64Slicer) AddSlicer

func (s *Float64Slicer) AddSlicer(value *Float64Slicer)

AddSlicer appends a Float64Slicer to the slicer

func (*Float64Slicer) AddUnique added in v1.5.0

func (s *Float64Slicer) AddUnique(value float64, additional ...float64)

AddUnique adds a float64 value to the slicer if it does not already exist

func (*Float64Slicer) AsSlice

func (s *Float64Slicer) AsSlice() []float64

AsSlice returns the slice

func (*Float64Slicer) Clear added in v1.3.4

func (s *Float64Slicer) Clear()

Clear all elements in the slice

func (*Float64Slicer) Contains added in v1.3.3

func (s *Float64Slicer) Contains(matcher float64) bool

Contains indicates if the given value is in the slice

func (*Float64Slicer) Deduplicate added in v1.4.1

func (s *Float64Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Float64Slicer) Each added in v1.2.0

func (s *Float64Slicer) Each(fn func(float64))

Each runs a function on every element of the slice

func (*Float64Slicer) Filter added in v1.1.0

func (s *Float64Slicer) Filter(fn func(float64) bool) *Float64Slicer

Filter the slice based on the given function

func (*Float64Slicer) Join added in v1.3.4

func (s *Float64Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Float64Slicer) Length added in v1.3.4

func (s *Float64Slicer) Length() int

Length returns the number of elements in the slice

func (*Float64Slicer) Sort added in v1.4.0

func (s *Float64Slicer) Sort()

Sort the slice values

type Int16Slicer

type Int16Slicer struct {
	// contains filtered or unexported fields
}

Int16Slicer handles slices of int16

func Int16

func Int16(slice ...[]int16) *Int16Slicer

Int16 creates a new Int16Slicer

func (*Int16Slicer) Add

func (s *Int16Slicer) Add(value int16, additional ...int16)

Add a int16 value to the slicer

func (*Int16Slicer) AddSlice

func (s *Int16Slicer) AddSlice(value []int16)

AddSlice adds a int16 slice to the slicer

func (*Int16Slicer) AddSlicer

func (s *Int16Slicer) AddSlicer(value *Int16Slicer)

AddSlicer appends a Int16Slicer to the slicer

func (*Int16Slicer) AddUnique added in v1.5.0

func (s *Int16Slicer) AddUnique(value int16, additional ...int16)

AddUnique adds a int16 value to the slicer if it does not already exist

func (*Int16Slicer) AsSlice

func (s *Int16Slicer) AsSlice() []int16

AsSlice returns the slice

func (*Int16Slicer) Clear added in v1.3.4

func (s *Int16Slicer) Clear()

Clear all elements in the slice

func (*Int16Slicer) Contains added in v1.3.3

func (s *Int16Slicer) Contains(matcher int16) bool

Contains indicates if the given value is in the slice

func (*Int16Slicer) Deduplicate added in v1.4.1

func (s *Int16Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Int16Slicer) Each added in v1.2.0

func (s *Int16Slicer) Each(fn func(int16))

Each runs a function on every element of the slice

func (*Int16Slicer) Filter added in v1.1.0

func (s *Int16Slicer) Filter(fn func(int16) bool) *Int16Slicer

Filter the slice based on the given function

func (*Int16Slicer) Join added in v1.3.4

func (s *Int16Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Int16Slicer) Length added in v1.3.4

func (s *Int16Slicer) Length() int

Length returns the number of elements in the slice

func (*Int16Slicer) Sort added in v1.4.0

func (s *Int16Slicer) Sort()

Sort the slice values

type Int32Slicer

type Int32Slicer struct {
	// contains filtered or unexported fields
}

Int32Slicer handles slices of int32

func Int32

func Int32(slice ...[]int32) *Int32Slicer

Int32 creates a new Int32Slicer

func (*Int32Slicer) Add

func (s *Int32Slicer) Add(value int32, additional ...int32)

Add a int32 value to the slicer

func (*Int32Slicer) AddSlice

func (s *Int32Slicer) AddSlice(value []int32)

AddSlice adds a int32 slice to the slicer

func (*Int32Slicer) AddSlicer

func (s *Int32Slicer) AddSlicer(value *Int32Slicer)

AddSlicer appends a Int32Slicer to the slicer

func (*Int32Slicer) AddUnique added in v1.5.0

func (s *Int32Slicer) AddUnique(value int32, additional ...int32)

AddUnique adds a int32 value to the slicer if it does not already exist

func (*Int32Slicer) AsSlice

func (s *Int32Slicer) AsSlice() []int32

AsSlice returns the slice

func (*Int32Slicer) Clear added in v1.3.4

func (s *Int32Slicer) Clear()

Clear all elements in the slice

func (*Int32Slicer) Contains added in v1.3.3

func (s *Int32Slicer) Contains(matcher int32) bool

Contains indicates if the given value is in the slice

func (*Int32Slicer) Deduplicate added in v1.4.1

func (s *Int32Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Int32Slicer) Each added in v1.2.0

func (s *Int32Slicer) Each(fn func(int32))

Each runs a function on every element of the slice

func (*Int32Slicer) Filter added in v1.1.0

func (s *Int32Slicer) Filter(fn func(int32) bool) *Int32Slicer

Filter the slice based on the given function

func (*Int32Slicer) Join added in v1.3.4

func (s *Int32Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Int32Slicer) Length added in v1.3.4

func (s *Int32Slicer) Length() int

Length returns the number of elements in the slice

func (*Int32Slicer) Sort added in v1.4.0

func (s *Int32Slicer) Sort()

Sort the slice values

type Int64Slicer

type Int64Slicer struct {
	// contains filtered or unexported fields
}

Int64Slicer handles slices of int64

func Int64

func Int64(slice ...[]int64) *Int64Slicer

Int64 creates a new Int64Slicer

func (*Int64Slicer) Add

func (s *Int64Slicer) Add(value int64, additional ...int64)

Add a int64 value to the slicer

func (*Int64Slicer) AddSlice

func (s *Int64Slicer) AddSlice(value []int64)

AddSlice adds a int64 slice to the slicer

func (*Int64Slicer) AddSlicer

func (s *Int64Slicer) AddSlicer(value *Int64Slicer)

AddSlicer appends a Int64Slicer to the slicer

func (*Int64Slicer) AddUnique added in v1.5.0

func (s *Int64Slicer) AddUnique(value int64, additional ...int64)

AddUnique adds a int64 value to the slicer if it does not already exist

func (*Int64Slicer) AsSlice

func (s *Int64Slicer) AsSlice() []int64

AsSlice returns the slice

func (*Int64Slicer) Clear added in v1.3.4

func (s *Int64Slicer) Clear()

Clear all elements in the slice

func (*Int64Slicer) Contains added in v1.3.3

func (s *Int64Slicer) Contains(matcher int64) bool

Contains indicates if the given value is in the slice

func (*Int64Slicer) Deduplicate added in v1.4.1

func (s *Int64Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Int64Slicer) Each added in v1.2.0

func (s *Int64Slicer) Each(fn func(int64))

Each runs a function on every element of the slice

func (*Int64Slicer) Filter added in v1.1.0

func (s *Int64Slicer) Filter(fn func(int64) bool) *Int64Slicer

Filter the slice based on the given function

func (*Int64Slicer) Join added in v1.3.4

func (s *Int64Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Int64Slicer) Length added in v1.3.4

func (s *Int64Slicer) Length() int

Length returns the number of elements in the slice

func (*Int64Slicer) Sort added in v1.4.0

func (s *Int64Slicer) Sort()

Sort the slice values

type Int8Slicer

type Int8Slicer struct {
	// contains filtered or unexported fields
}

Int8Slicer handles slices of int8

func Int8

func Int8(slice ...[]int8) *Int8Slicer

Int8 creates a new Int8Slicer

func (*Int8Slicer) Add

func (s *Int8Slicer) Add(value int8, additional ...int8)

Add a int8 value to the slicer

func (*Int8Slicer) AddSlice

func (s *Int8Slicer) AddSlice(value []int8)

AddSlice adds a int8 slice to the slicer

func (*Int8Slicer) AddSlicer

func (s *Int8Slicer) AddSlicer(value *Int8Slicer)

AddSlicer appends a Int8Slicer to the slicer

func (*Int8Slicer) AddUnique added in v1.5.0

func (s *Int8Slicer) AddUnique(value int8, additional ...int8)

AddUnique adds a int8 value to the slicer if it does not already exist

func (*Int8Slicer) AsSlice

func (s *Int8Slicer) AsSlice() []int8

AsSlice returns the slice

func (*Int8Slicer) Clear added in v1.3.4

func (s *Int8Slicer) Clear()

Clear all elements in the slice

func (*Int8Slicer) Contains added in v1.3.3

func (s *Int8Slicer) Contains(matcher int8) bool

Contains indicates if the given value is in the slice

func (*Int8Slicer) Deduplicate added in v1.4.1

func (s *Int8Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Int8Slicer) Each added in v1.2.0

func (s *Int8Slicer) Each(fn func(int8))

Each runs a function on every element of the slice

func (*Int8Slicer) Filter added in v1.1.0

func (s *Int8Slicer) Filter(fn func(int8) bool) *Int8Slicer

Filter the slice based on the given function

func (*Int8Slicer) Join added in v1.3.4

func (s *Int8Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Int8Slicer) Length added in v1.3.4

func (s *Int8Slicer) Length() int

Length returns the number of elements in the slice

func (*Int8Slicer) Sort added in v1.4.0

func (s *Int8Slicer) Sort()

Sort the slice values

type IntSlicer

type IntSlicer struct {
	// contains filtered or unexported fields
}

IntSlicer handles slices of int

func Int

func Int(slice ...[]int) *IntSlicer

Int creates a new IntSlicer

func (*IntSlicer) Add

func (s *IntSlicer) Add(value int, additional ...int)

Add a int value to the slicer

func (*IntSlicer) AddSlice

func (s *IntSlicer) AddSlice(value []int)

AddSlice adds a int slice to the slicer

func (*IntSlicer) AddSlicer

func (s *IntSlicer) AddSlicer(value *IntSlicer)

AddSlicer appends a IntSlicer to the slicer

func (*IntSlicer) AddUnique added in v1.5.0

func (s *IntSlicer) AddUnique(value int, additional ...int)

AddUnique adds a int value to the slicer if it does not already exist

func (*IntSlicer) AsSlice

func (s *IntSlicer) AsSlice() []int

AsSlice returns the slice

func (*IntSlicer) Clear added in v1.3.4

func (s *IntSlicer) Clear()

Clear all elements in the slice

func (*IntSlicer) Contains added in v1.3.3

func (s *IntSlicer) Contains(matcher int) bool

Contains indicates if the given value is in the slice

func (*IntSlicer) Deduplicate added in v1.4.1

func (s *IntSlicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*IntSlicer) Each added in v1.2.0

func (s *IntSlicer) Each(fn func(int))

Each runs a function on every element of the slice

func (*IntSlicer) Filter added in v1.1.0

func (s *IntSlicer) Filter(fn func(int) bool) *IntSlicer

Filter the slice based on the given function

func (*IntSlicer) Join added in v1.3.4

func (s *IntSlicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*IntSlicer) Length added in v1.3.4

func (s *IntSlicer) Length() int

Length returns the number of elements in the slice

func (*IntSlicer) Sort added in v1.4.0

func (s *IntSlicer) Sort()

Sort the slice values

type InterfaceSlicer

type InterfaceSlicer struct {
	// contains filtered or unexported fields
}

InterfaceSlicer handles slices of interface{}

func Interface

func Interface(slice ...[]interface{}) *InterfaceSlicer

Interface creates a new InterfaceSlicer

func (*InterfaceSlicer) Add

func (s *InterfaceSlicer) Add(value interface{}, additional ...interface{})

Add a interface{} value to the slicer

func (*InterfaceSlicer) AddSlice

func (s *InterfaceSlicer) AddSlice(value []interface{})

AddSlice adds a interface{} slice to the slicer

func (*InterfaceSlicer) AddSlicer

func (s *InterfaceSlicer) AddSlicer(value *InterfaceSlicer)

AddSlicer appends a InterfaceSlicer to the slicer

func (*InterfaceSlicer) AddUnique added in v1.5.0

func (s *InterfaceSlicer) AddUnique(value interface{}, additional ...interface{})

AddUnique adds a interface{} value to the slicer if it does not already exist

func (*InterfaceSlicer) AsSlice

func (s *InterfaceSlicer) AsSlice() []interface{}

AsSlice returns the slice

func (*InterfaceSlicer) Clear added in v1.3.4

func (s *InterfaceSlicer) Clear()

Clear all elements in the slice

func (*InterfaceSlicer) Contains added in v1.3.3

func (s *InterfaceSlicer) Contains(matcher interface{}) bool

Contains indicates if the given value is in the slice

func (*InterfaceSlicer) Deduplicate added in v1.4.1

func (s *InterfaceSlicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*InterfaceSlicer) Each added in v1.2.0

func (s *InterfaceSlicer) Each(fn func(interface{}))

Each runs a function on every element of the slice

func (*InterfaceSlicer) Filter added in v1.1.0

func (s *InterfaceSlicer) Filter(fn func(interface{}) bool) *InterfaceSlicer

Filter the slice based on the given function

func (*InterfaceSlicer) Join added in v1.3.4

func (s *InterfaceSlicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*InterfaceSlicer) Length added in v1.3.4

func (s *InterfaceSlicer) Length() int

Length returns the number of elements in the slice

type StringSlicer

type StringSlicer struct {
	// contains filtered or unexported fields
}

StringSlicer handles slices of string

func String

func String(slice ...[]string) *StringSlicer

String creates a new StringSlicer

func (*StringSlicer) Add

func (s *StringSlicer) Add(value string, additional ...string)

Add a string value to the slicer

func (*StringSlicer) AddSlice

func (s *StringSlicer) AddSlice(value []string)

AddSlice adds a string slice to the slicer

func (*StringSlicer) AddSlicer

func (s *StringSlicer) AddSlicer(value *StringSlicer)

AddSlicer appends a StringSlicer to the slicer

func (*StringSlicer) AddUnique added in v1.5.0

func (s *StringSlicer) AddUnique(value string, additional ...string)

AddUnique adds a string value to the slicer if it does not already exist

func (*StringSlicer) AsSlice

func (s *StringSlicer) AsSlice() []string

AsSlice returns the slice

func (*StringSlicer) Clear added in v1.3.4

func (s *StringSlicer) Clear()

Clear all elements in the slice

func (*StringSlicer) Contains added in v1.3.3

func (s *StringSlicer) Contains(matcher string) bool

Contains indicates if the given value is in the slice

func (*StringSlicer) Deduplicate added in v1.4.1

func (s *StringSlicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*StringSlicer) Each added in v1.2.0

func (s *StringSlicer) Each(fn func(string))

Each runs a function on every element of the slice

func (*StringSlicer) Filter added in v1.1.0

func (s *StringSlicer) Filter(fn func(string) bool) *StringSlicer

Filter the slice based on the given function

func (*StringSlicer) Join added in v1.3.4

func (s *StringSlicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*StringSlicer) Length added in v1.3.4

func (s *StringSlicer) Length() int

Length returns the number of elements in the slice

func (*StringSlicer) Sort added in v1.3.2

func (s *StringSlicer) Sort()

Sort the slice values

type Uint16Slicer added in v1.6.0

type Uint16Slicer struct {
	// contains filtered or unexported fields
}

Uint16Slicer handles slices of uint16

func Uint16 added in v1.6.0

func Uint16(slice ...[]uint16) *Uint16Slicer

Uint16 creates a new Uint16Slicer

func (*Uint16Slicer) Add added in v1.6.0

func (s *Uint16Slicer) Add(value uint16, additional ...uint16)

Add a uint16 value to the slicer

func (*Uint16Slicer) AddSlice added in v1.6.0

func (s *Uint16Slicer) AddSlice(value []uint16)

AddSlice adds a uint16 slice to the slicer

func (*Uint16Slicer) AddSlicer added in v1.6.0

func (s *Uint16Slicer) AddSlicer(value *Uint16Slicer)

AddSlicer appends a Uint16Slicer to the slicer

func (*Uint16Slicer) AddUnique added in v1.6.0

func (s *Uint16Slicer) AddUnique(value uint16, additional ...uint16)

AddUnique adds a uint16 value to the slicer if it does not already exist

func (*Uint16Slicer) AsSlice added in v1.6.0

func (s *Uint16Slicer) AsSlice() []uint16

AsSlice returns the slice

func (*Uint16Slicer) Clear added in v1.6.0

func (s *Uint16Slicer) Clear()

Clear all elements in the slice

func (*Uint16Slicer) Contains added in v1.6.0

func (s *Uint16Slicer) Contains(matcher uint16) bool

Contains indicates if the given value is in the slice

func (*Uint16Slicer) Deduplicate added in v1.6.0

func (s *Uint16Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Uint16Slicer) Each added in v1.6.0

func (s *Uint16Slicer) Each(fn func(uint16))

Each runs a function on every element of the slice

func (*Uint16Slicer) Filter added in v1.6.0

func (s *Uint16Slicer) Filter(fn func(uint16) bool) *Uint16Slicer

Filter the slice based on the given function

func (*Uint16Slicer) Join added in v1.6.0

func (s *Uint16Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Uint16Slicer) Length added in v1.6.0

func (s *Uint16Slicer) Length() int

Length returns the number of elements in the slice

func (*Uint16Slicer) Sort added in v1.6.0

func (s *Uint16Slicer) Sort()

Sort the slice values

type Uint32Slicer added in v1.6.0

type Uint32Slicer struct {
	// contains filtered or unexported fields
}

Uint32Slicer handles slices of uint32

func Uint32 added in v1.6.0

func Uint32(slice ...[]uint32) *Uint32Slicer

Uint32 creates a new Uint32Slicer

func (*Uint32Slicer) Add added in v1.6.0

func (s *Uint32Slicer) Add(value uint32, additional ...uint32)

Add a uint32 value to the slicer

func (*Uint32Slicer) AddSlice added in v1.6.0

func (s *Uint32Slicer) AddSlice(value []uint32)

AddSlice adds a uint32 slice to the slicer

func (*Uint32Slicer) AddSlicer added in v1.6.0

func (s *Uint32Slicer) AddSlicer(value *Uint32Slicer)

AddSlicer appends a Uint32Slicer to the slicer

func (*Uint32Slicer) AddUnique added in v1.6.0

func (s *Uint32Slicer) AddUnique(value uint32, additional ...uint32)

AddUnique adds a uint32 value to the slicer if it does not already exist

func (*Uint32Slicer) AsSlice added in v1.6.0

func (s *Uint32Slicer) AsSlice() []uint32

AsSlice returns the slice

func (*Uint32Slicer) Clear added in v1.6.0

func (s *Uint32Slicer) Clear()

Clear all elements in the slice

func (*Uint32Slicer) Contains added in v1.6.0

func (s *Uint32Slicer) Contains(matcher uint32) bool

Contains indicates if the given value is in the slice

func (*Uint32Slicer) Deduplicate added in v1.6.0

func (s *Uint32Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Uint32Slicer) Each added in v1.6.0

func (s *Uint32Slicer) Each(fn func(uint32))

Each runs a function on every element of the slice

func (*Uint32Slicer) Filter added in v1.6.0

func (s *Uint32Slicer) Filter(fn func(uint32) bool) *Uint32Slicer

Filter the slice based on the given function

func (*Uint32Slicer) Join added in v1.6.0

func (s *Uint32Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Uint32Slicer) Length added in v1.6.0

func (s *Uint32Slicer) Length() int

Length returns the number of elements in the slice

func (*Uint32Slicer) Sort added in v1.6.0

func (s *Uint32Slicer) Sort()

Sort the slice values

type Uint64Slicer added in v1.6.0

type Uint64Slicer struct {
	// contains filtered or unexported fields
}

Uint64Slicer handles slices of uint64

func Uint64 added in v1.6.0

func Uint64(slice ...[]uint64) *Uint64Slicer

Uint64 creates a new Uint64Slicer

func (*Uint64Slicer) Add added in v1.6.0

func (s *Uint64Slicer) Add(value uint64, additional ...uint64)

Add a uint64 value to the slicer

func (*Uint64Slicer) AddSlice added in v1.6.0

func (s *Uint64Slicer) AddSlice(value []uint64)

AddSlice adds a uint64 slice to the slicer

func (*Uint64Slicer) AddSlicer added in v1.6.0

func (s *Uint64Slicer) AddSlicer(value *Uint64Slicer)

AddSlicer appends a Uint64Slicer to the slicer

func (*Uint64Slicer) AddUnique added in v1.6.0

func (s *Uint64Slicer) AddUnique(value uint64, additional ...uint64)

AddUnique adds a uint64 value to the slicer if it does not already exist

func (*Uint64Slicer) AsSlice added in v1.6.0

func (s *Uint64Slicer) AsSlice() []uint64

AsSlice returns the slice

func (*Uint64Slicer) Clear added in v1.6.0

func (s *Uint64Slicer) Clear()

Clear all elements in the slice

func (*Uint64Slicer) Contains added in v1.6.0

func (s *Uint64Slicer) Contains(matcher uint64) bool

Contains indicates if the given value is in the slice

func (*Uint64Slicer) Deduplicate added in v1.6.0

func (s *Uint64Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Uint64Slicer) Each added in v1.6.0

func (s *Uint64Slicer) Each(fn func(uint64))

Each runs a function on every element of the slice

func (*Uint64Slicer) Filter added in v1.6.0

func (s *Uint64Slicer) Filter(fn func(uint64) bool) *Uint64Slicer

Filter the slice based on the given function

func (*Uint64Slicer) Join added in v1.6.0

func (s *Uint64Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Uint64Slicer) Length added in v1.6.0

func (s *Uint64Slicer) Length() int

Length returns the number of elements in the slice

func (*Uint64Slicer) Sort added in v1.6.0

func (s *Uint64Slicer) Sort()

Sort the slice values

type Uint8Slicer added in v1.6.0

type Uint8Slicer struct {
	// contains filtered or unexported fields
}

Uint8Slicer handles slices of uint8

func Uint8 added in v1.6.0

func Uint8(slice ...[]uint8) *Uint8Slicer

Uint8 creates a new Uint8Slicer

func (*Uint8Slicer) Add added in v1.6.0

func (s *Uint8Slicer) Add(value uint8, additional ...uint8)

Add a uint8 value to the slicer

func (*Uint8Slicer) AddSlice added in v1.6.0

func (s *Uint8Slicer) AddSlice(value []uint8)

AddSlice adds a uint8 slice to the slicer

func (*Uint8Slicer) AddSlicer added in v1.6.0

func (s *Uint8Slicer) AddSlicer(value *Uint8Slicer)

AddSlicer appends a Uint8Slicer to the slicer

func (*Uint8Slicer) AddUnique added in v1.6.0

func (s *Uint8Slicer) AddUnique(value uint8, additional ...uint8)

AddUnique adds a uint8 value to the slicer if it does not already exist

func (*Uint8Slicer) AsSlice added in v1.6.0

func (s *Uint8Slicer) AsSlice() []uint8

AsSlice returns the slice

func (*Uint8Slicer) Clear added in v1.6.0

func (s *Uint8Slicer) Clear()

Clear all elements in the slice

func (*Uint8Slicer) Contains added in v1.6.0

func (s *Uint8Slicer) Contains(matcher uint8) bool

Contains indicates if the given value is in the slice

func (*Uint8Slicer) Deduplicate added in v1.6.0

func (s *Uint8Slicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*Uint8Slicer) Each added in v1.6.0

func (s *Uint8Slicer) Each(fn func(uint8))

Each runs a function on every element of the slice

func (*Uint8Slicer) Filter added in v1.6.0

func (s *Uint8Slicer) Filter(fn func(uint8) bool) *Uint8Slicer

Filter the slice based on the given function

func (*Uint8Slicer) Join added in v1.6.0

func (s *Uint8Slicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*Uint8Slicer) Length added in v1.6.0

func (s *Uint8Slicer) Length() int

Length returns the number of elements in the slice

func (*Uint8Slicer) Sort added in v1.6.0

func (s *Uint8Slicer) Sort()

Sort the slice values

type UintSlicer added in v1.6.0

type UintSlicer struct {
	// contains filtered or unexported fields
}

UintSlicer handles slices of uint

func Uint added in v1.6.0

func Uint(slice ...[]uint) *UintSlicer

Uint creates a new UintSlicer

func (*UintSlicer) Add added in v1.6.0

func (s *UintSlicer) Add(value uint, additional ...uint)

Add a uint value to the slicer

func (*UintSlicer) AddSlice added in v1.6.0

func (s *UintSlicer) AddSlice(value []uint)

AddSlice adds a uint slice to the slicer

func (*UintSlicer) AddSlicer added in v1.6.0

func (s *UintSlicer) AddSlicer(value *UintSlicer)

AddSlicer appends a UintSlicer to the slicer

func (*UintSlicer) AddUnique added in v1.6.0

func (s *UintSlicer) AddUnique(value uint, additional ...uint)

AddUnique adds a uint value to the slicer if it does not already exist

func (*UintSlicer) AsSlice added in v1.6.0

func (s *UintSlicer) AsSlice() []uint

AsSlice returns the slice

func (*UintSlicer) Clear added in v1.6.0

func (s *UintSlicer) Clear()

Clear all elements in the slice

func (*UintSlicer) Contains added in v1.6.0

func (s *UintSlicer) Contains(matcher uint) bool

Contains indicates if the given value is in the slice

func (*UintSlicer) Deduplicate added in v1.6.0

func (s *UintSlicer) Deduplicate()

Deduplicate removes duplicate values from the slice

func (*UintSlicer) Each added in v1.6.0

func (s *UintSlicer) Each(fn func(uint))

Each runs a function on every element of the slice

func (*UintSlicer) Filter added in v1.6.0

func (s *UintSlicer) Filter(fn func(uint) bool) *UintSlicer

Filter the slice based on the given function

func (*UintSlicer) Join added in v1.6.0

func (s *UintSlicer) Join(separator string) string

Join returns a string with the slicer elements separated by the given separator

func (*UintSlicer) Length added in v1.6.0

func (s *UintSlicer) Length() int

Length returns the number of elements in the slice

func (*UintSlicer) Sort added in v1.6.0

func (s *UintSlicer) Sort()

Sort the slice values

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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