feat: add example

This commit is contained in:
sujit
2024-10-08 18:34:21 +05:45
parent 75419c45bb
commit ff2922eddf
7 changed files with 129 additions and 39 deletions

5
ctx.go
View File

@@ -8,6 +8,7 @@ import (
"fmt"
"net"
"os"
"sync"
"time"
"github.com/oarkflow/xid"
@@ -38,7 +39,11 @@ func IsClosed(conn net.Conn) bool {
return false
}
var m = sync.RWMutex{}
func SetHeaders(ctx context.Context, headers map[string]string) context.Context {
m.Lock()
defer m.Unlock()
hd, ok := GetHeaders(ctx)
if !ok {
hd = make(map[string]string)