feat: add dig command
Other changes: - use middleware for permission checking - able to respond with emoji - log incoming requests
This commit is contained in:
parent
412725c6b9
commit
37dffe56ce
3 changed files with 285 additions and 7 deletions
18
utils/utils.go
Normal file
18
utils/utils.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
package utils
|
||||
|
||||
func WaitFor(fn func()) <-chan struct{} {
|
||||
ch := make(chan struct{})
|
||||
go func() {
|
||||
defer close(ch)
|
||||
fn()
|
||||
}()
|
||||
return ch
|
||||
}
|
||||
|
||||
func ToLookupMap[T comparable](s []T) map[T]struct{} {
|
||||
m := make(map[T]struct{}, len(s))
|
||||
for _, item := range s {
|
||||
m[item] = struct{}{}
|
||||
}
|
||||
return m
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue