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 MapDefault
- type MapSliceDefault
- type StringSet
- func (set *StringSet) Add(ss ...string)
- 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapDefault ¶ added in v0.1.333
MapDefault provides defaults for string map lookups with defaults.
func (MapDefault) Lookup ¶ added in v0.1.333
func (m MapDefault) Lookup(key, def string) string
Lookup map with a default value.
type MapSliceDefault ¶ added in v0.1.333
MapSliceDefault provides defaults for string map lookups.
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 NewStringSetReader ¶ added in v0.1.329
NewStringSetReader reads from reader linewise, each line corresponding to one item in set.
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