id

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package id contains functions for dealing with various UUID containers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map map[uuid.UUID]struct{}

Map describes a map of UUID keys with empty structs as their values

func MapFromSlice

func MapFromSlice(s Slice) Map

MapFromSlice constructs a map of empty struct values with keys taken from the given slice.

func (Map) Copy

func (m Map) Copy() Map

Copy returns a standalone copy of this map.

func (Map) String

func (m Map) String() string

String returns all map keys separated by ", ".

func (Map) ToSlice

func (m Map) ToSlice() Slice

ToSlice takes all keys from the given map and returns them as an array.

func (Map) ToString

func (m Map) ToString(sep string, fn ...func(ID uuid.UUID) string) string

ToString returns all IDs as a string separated by the given separation string. If a callback is specified that callback will be called for every ID to generate a custom output string for that element.

type Slice

type Slice []uuid.UUID

Slice describes a slice of UUID objects

func (*Slice) Add

func (s *Slice) Add(b Slice)

Add appends all elements from b to this slice using append

func (Slice) Diff

func (s Slice) Diff(b Slice) Slice

Diff returns the difference between this and the given slice.

func (Slice) Len

func (s Slice) Len() int

Len is the number of elements in the collection.

func (Slice) Less

func (s Slice) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (Slice) String

func (s Slice) String() string

String returns all IDs separated by ", ".

func (Slice) Sub

func (s Slice) Sub(b Slice) Slice

Sub returns the result of removing elements in b from the given slice.

func (Slice) Swap

func (s Slice) Swap(i, j int)

Swap swaps the elements with indexes i and j.

func (Slice) ToMap

func (s Slice) ToMap() Map

ToMap creates an ID map with the slice elements as keys.

func (Slice) ToString

func (s Slice) ToString(sep string, fn ...func(ID uuid.UUID) string) string

ToString returns all IDs as a string separated by the given separation string. If a callback is specified that callback will be called for every ID to generate a custom output string for that element.

func (Slice) ToStringSlice

func (s Slice) ToStringSlice() []string

ToStringSlice returns a string slice with all IDs as string in it.

func (Slice) Unique

func (s Slice) Unique() Slice

Unique returns a slice in which all duplicate elements have been removed.

Jump to

Keyboard shortcuts

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