mirror of
https://github.com/luxfi/database.git
synced 2026-10-30 15:01:18 +00:00
- Add //go:build leveldb to all leveldb package files - Add //go:build pebbledb to all pebbledb package files - Refactor factory to use registration pattern - Refactor manager to use registration pattern - badgerdb is now the only default database - Build with -tags=leveldb or -tags=pebbledb to enable them
27 lines
520 B
Go
27 lines
520 B
Go
// Copyright (C) 2020-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build pebbledb
|
|
|
|
package pebbledb
|
|
|
|
// set is a simple generic set implementation
|
|
type set[T comparable] map[T]struct{}
|
|
|
|
// Add adds an element to the set
|
|
func (s set[T]) Add(t T) {
|
|
s[t] = struct{}{}
|
|
}
|
|
|
|
// Remove removes an element from the set
|
|
func (s set[T]) Remove(t T) {
|
|
delete(s, t)
|
|
}
|
|
|
|
// Clear removes all elements from the set
|
|
func (s set[T]) Clear() {
|
|
for k := range s {
|
|
delete(s, k)
|
|
}
|
|
}
|