You've already forked postgres_exporter
mirror of
https://github.com/prometheus-community/postgres_exporter.git
synced 2025-08-08 04:42:07 +03:00
30 lines
536 B
Go
30 lines
536 B
Go
package main
|
|
|
|
type stringSet struct {
|
|
items map[string]struct{}
|
|
}
|
|
|
|
func newStringSet(items ...string) *stringSet {
|
|
setItems := make(map[string]struct{}, len(items))
|
|
for _, item := range items {
|
|
setItems[item] = struct{}{}
|
|
}
|
|
return &stringSet{items: setItems}
|
|
}
|
|
|
|
func (s *stringSet) add(item string) {
|
|
s.items[item] = struct{}{}
|
|
}
|
|
|
|
func (s *stringSet) asSlice() []string {
|
|
items := []string{}
|
|
for item := range s.items {
|
|
items = append(items, item)
|
|
}
|
|
return items
|
|
}
|
|
|
|
func (s *stringSet) size() int {
|
|
return len(s.items)
|
|
}
|