dedupe

package module
v0.0.0-...-d21d9ba Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 2 Imported by: 0

README

移行しました

go-utils/dedupe

これはなんぞ?

[]int{1, 2, 3, 3}や、[]string{"1", "2", "3", "3"}となっているスライスから、
重複しているものを取り除く時に型ごとに自前実装しないといけない
そんな時に一つにまとめられていて少しでも使えるものを作りました。

導入

go get -u github.com/54m/dedup

使い方は こちら

ライセンス

MIT

Documentation

Overview

Package dedupe - Deduplication among various types of slices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(args interface{}) error

Do simply dedupe

Types

type Deduplication

type Deduplication struct {
	SliceBool    []bool
	SliceFloat32 []float32
	SliceFloat64 []float64
	SliceInt     []int
	SliceInt64   []int64
	SliceUint    []uint
	SliceUint64  []uint64
	SliceString  []string
	SliceAny     interface{}

	CastFailed bool
	NotChange  bool
	Value      *reflect.Value
	Error      error
}

Deduplication duplicate exclusion

supports type:
  []bool, []float32, []float64, []int, []int64,
  []uint, []uint64, []string, []struct, []*struct, []AnyType
no supports type: []func

func NewDeduplication

func NewDeduplication() *Deduplication

NewDeduplication constructor NotChange field: true

func (*Deduplication) Any

func (d *Deduplication) Any() (interface{}, error)

Any returns the deduplicated slice

func (*Deduplication) Do

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

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) String

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

String 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