init
This commit is contained in:
18
domain/client.go
Normal file
18
domain/client.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"go_oxspeak_server/models"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
User models.User
|
||||
|
||||
mu sync.RWMutex
|
||||
}
|
||||
|
||||
func newClient(user models.User) *Client {
|
||||
return &Client{
|
||||
User: user,
|
||||
}
|
||||
}
|
||||
15
domain/client_manager.go
Normal file
15
domain/client_manager.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"github.com/puzpuzpuz/xsync/v4"
|
||||
)
|
||||
|
||||
type ClientManager struct {
|
||||
clients *xsync.Map[string, Client]
|
||||
}
|
||||
|
||||
func NewClientManager() *ClientManager {
|
||||
return &ClientManager{
|
||||
clients: xsync.NewMap[string, Client](),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user