package part
-import (
- "sync"
-)
-
-type Map struct{
- m sync.Map
- New func()interface{}
-}
-
-func (t *Map) Get(key interface{})interface{}{
- if val,ok := t.m.Load(key);ok{return val}
- return t.Set(key, t.New())
+func Contains[T comparable, S any](s map[T]S, keys ...T) (missKey []T) {
+ for _, tk := range keys {
+ if _, ok := s[tk]; !ok {
+ missKey = append(missKey, tk)
+ }
+ }
+ return
}
-
-func (t *Map) Del(key interface{}){
- t.m.Delete(key)
-}
-
-func (t *Map) Set(key interface{},val interface{})interface{}{
- t.m.Store(key, val)
- return val
-}
\ No newline at end of file
import (
"encoding/json"
+ "iter"
"net"
"net/http"
"strings"
return
}
+func Iter_2_Cookies_String(Cookies iter.Seq2[string, string]) (o string) {
+ for k, v := range Cookies {
+ o += k + `=` + v + `; `
+ }
+ t := []rune(o)
+ o = string(t[:len(t)-2])
+ return
+}
+
func Map_2_Cookies_String(Cookies map[string]string) (o string) {
if len(Cookies) == 0 {
return ""
}
return t
}
+
+func StoreAll[T comparable, S any, A, B any](d MapFunc[A, B], s map[T]S) {
+ for k, v := range s {
+ d.Store(any(k).(A), any(v).(B))
+ }
+}
+
+func Contains[A, B any](m MapFunc[A, B], keys ...A) (missKey []A) {
+ for _, tk := range keys {
+ if _, ok := m.Load(tk); !ok {
+ missKey = append(missKey, tk)
+ }
+ }
+ return
+}