refactor: restructure session initialization to avoid circular references

This commit is contained in:
2025-12-04 19:32:00 +07:00
parent 82050a738f
commit 039e979142
10 changed files with 448 additions and 330 deletions

32
session/slug/slug.go Normal file
View File

@ -0,0 +1,32 @@
package slug
import "sync"
type Manager interface {
Get() string
Set(slug string)
}
type manager struct {
slug string
slugMu sync.RWMutex
}
func NewManager() Manager {
return &manager{
slug: "",
slugMu: sync.RWMutex{},
}
}
func (s *manager) Get() string {
s.slugMu.RLock()
defer s.slugMu.RUnlock()
return s.slug
}
func (s *manager) Set(slug string) {
s.slugMu.Lock()
s.slug = slug
s.slugMu.Unlock()
}