container

package
v0.1.292 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: GPL-3.0 Imports: 3 Imported by: 3

Documentation

Overview

Package sets implements basic set types.

Copyright 2015 by Leipzig University Library, http://ub.uni-leipzig.de
                  The Finc Authors, http://finc.info
                  Martin Czygan, <martin.czygan@uni-leipzig.de>

This file is part of some open source application.

Some open source application is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Some open source application is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>.

@license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringMap

type StringMap map[string]string

StringMap provides defaults for string map lookups with defaults.

func (StringMap) LookupDefault

func (m StringMap) LookupDefault(key, def string) string

LookupDefault map with a default value.

func (StringMap) UnmarshalJSON

func (m StringMap) UnmarshalJSON(data []byte) error

type StringSet

type StringSet struct {
	Set map[string]struct{}
}

StringSet is map disguised as set.

func NewStringSet

func NewStringSet(s ...string) *StringSet

NewStringSet returns an empty string set. XXX: Make the zero value usable.

func (*StringSet) Add

func (set *StringSet) Add(s string) bool

Add adds a string to a set, returns true if added, false it it already existed (noop).

func (*StringSet) AddAll

func (set *StringSet) AddAll(s ...string) bool

AddAll adds adds a set of string to a set.

func (*StringSet) Contains

func (set *StringSet) Contains(s string) bool

Contains returns true if given string is in the set, false otherwise.

func (*StringSet) Difference added in v0.1.258

func (set *StringSet) Difference(other *StringSet) *StringSet

Difference returns all items, that are in set but not in other.

func (*StringSet) Intersection added in v0.1.258

func (set *StringSet) Intersection(other *StringSet) *StringSet

Intersection returns the intersection of two string sets.

func (*StringSet) Size

func (set *StringSet) Size() int

Size returns current number of elements in the set.

func (*StringSet) SortedValues

func (set *StringSet) SortedValues() (values []string)

Values returns the set values as a string slice.

func (*StringSet) Values

func (set *StringSet) Values() (values []string)

Values returns the set values as a string slice.

type StringSlice

type StringSlice []string

Define a type named "StringSlice" as a slice of strings. Useful for repeated command line flags.

func (*StringSlice) Set

func (i *StringSlice) Set(value string) error

The second method is Set(value string) error

func (*StringSlice) String

func (i *StringSlice) String() string

Now, for our new type, implement the two methods of the flag.Value interface... The first method is String() string

type StringSliceMap

type StringSliceMap map[string][]string

StringMap provides defaults for string map lookups.

func (StringSliceMap) LookupDefault

func (m StringSliceMap) LookupDefault(key string, def []string) []string

LookupDefault with default value.

Jump to

Keyboard shortcuts

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