Improve logging, improve rate limit, add running main Router
This commit is contained in:
17
util/constmap.go
Normal file
17
util/constmap.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package util
|
||||
|
||||
// ImmutableMap for disallowing change of elements during runtime, for threadsafty
|
||||
type ImmutableMap[K comparable, V any] struct {
|
||||
dirty map[K]V
|
||||
}
|
||||
|
||||
func NewImmutableMap[K comparable, V any](m map[K]V) *ImmutableMap[K, V] {
|
||||
return &ImmutableMap[K, V]{
|
||||
dirty: m,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *ImmutableMap[K, V]) Get(key K) (value V, ok bool) {
|
||||
value, ok = m.dirty[key]
|
||||
return value, ok
|
||||
}
|
||||
Reference in New Issue
Block a user