sdk: FetchSpecificEvent()

This commit is contained in:
fiatjaf
2024-10-06 15:53:33 -03:00
parent f08e4e9af7
commit 36c197af42
5 changed files with 226 additions and 39 deletions

View File

@@ -1,12 +1,18 @@
package sdk
import "time"
import (
"slices"
"time"
)
var serial = 0
func pickNext(list []string) string {
serial++
return list[serial%len(list)]
func appendUnique[I comparable](arr []I, item ...I) []I {
for _, item := range item {
if slices.Contains(arr, item) {
return arr
}
arr = append(arr, item)
}
return arr
}
func doThisNotMoreThanOnceAnHour(key string) (doItNow bool) {