dedup

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: MIT Imports: 4 Imported by: 0

README

What is this?

[]int{1, 2, 3, 3}, []string{"1", "2", "3", "3"}, []float64{0.1, 0.2, 0.3, 0.3} etc.
You have to implement each type by yourself when removing duplicates from existing slices.
At that time, I made something that was put together and can be used even a little.

Installation

go get -u github.com/go-utils/dedup

Usage

import (
    "fmt"

    "github.com/go-utils/dedup"
)

ded := dedup.NewDeduplication()
sliceStr := []string{"Go", "V", "Java", "Python", "Go", "Ruby", "Go", "V"}
str, _ := ded.Do(sliceStr).Str()
fmt.Println(str)
Result
[Go Java Python Ruby V]

Support

[]float32 []float64 []int []int64 []uint []uint64 []string

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deduplication

type Deduplication struct {
	SliceFloat32 []float32
	SliceFloat64 []float64
	SliceInt     []int
	SliceInt64   []int64
	SliceUint    []uint
	SliceUint64  []uint64
	SliceStr     []string

	Value *reflect.Value
	Error error
}

Deduplication duplicate exclusion

└── Supports type: []float32, []float64, []int, []int64, []uint, []uint64, []string

func NewDeduplication

func NewDeduplication() *Deduplication

NewDeduplication constructor

func (*Deduplication) Do

func (d *Deduplication) Do(args interface{}) *Deduplication

Do divide processing by type

func (*Deduplication) Float32

func (d *Deduplication) Float32() ([]float32, error)

Float32 returns the deduplicated slice

func (*Deduplication) Float64

func (d *Deduplication) Float64() ([]float64, error)

Float64 returns the deduplicated slice

func (*Deduplication) Int

func (d *Deduplication) Int() ([]int, error)

Int returns the deduplicated slice

func (*Deduplication) Int64

func (d *Deduplication) Int64() ([]int64, error)

Int64 returns the deduplicated slice

func (*Deduplication) Str

func (d *Deduplication) Str() ([]string, error)

Str returns the deduplicated slice

func (*Deduplication) Uint

func (d *Deduplication) Uint() ([]uint, error)

Uint returns the deduplicated slice

func (*Deduplication) Uint64

func (d *Deduplication) Uint64() ([]uint64, error)

Uint64 returns the deduplicated slice

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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