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 ¶
- type StringMap
- type StringSet
- func (set *StringSet) Add(s string) bool
- func (set *StringSet) AddAll(s ...string) bool
- func (set *StringSet) Contains(s string) bool
- func (set *StringSet) Difference(other *StringSet) *StringSet
- func (set *StringSet) Intersection(other *StringSet) *StringSet
- func (set *StringSet) Size() int
- func (set *StringSet) SortedValues() (values []string)
- func (set *StringSet) Values() (values []string)
- type StringSlice
- type StringSliceMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringMap ¶
StringMap provides defaults for string map lookups with defaults.
func (StringMap) LookupDefault ¶
LookupDefault map with a default value.
func (StringMap) UnmarshalJSON ¶
type StringSet ¶
type StringSet struct {
Set map[string]struct{}
}
StringSet is map disguised as set.
func NewStringSet ¶
NewStringSet returns an empty string set. XXX: Make the zero value usable.
func (*StringSet) Add ¶
Add adds a string to a set, returns true if added, false it it already existed (noop).
func (*StringSet) Difference ¶ added in v0.1.258
Difference returns all items, that are in set but not in other.
func (*StringSet) Intersection ¶ added in v0.1.258
Intersection returns the intersection of two string sets.
func (*StringSet) SortedValues ¶
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 ¶
StringMap provides defaults for string map lookups.
func (StringSliceMap) LookupDefault ¶
func (m StringSliceMap) LookupDefault(key string, def []string) []string
LookupDefault with default value.