feat: first init

This commit is contained in:
Cereska
2026-02-26 08:21:58 -05:00
commit a1b599d030
11 changed files with 188 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
package models
import (
"sync"
"time"
)
type Channel struct {
ID string `json:"id"`
RoomName string `json:"room_name"`
TotalMessages int64 `json:"total_messages"`
Messages []Message
mu sync.RWMutex
}
type Message struct {
Content string
Sender *User
Timestamp time.Time
}
// Methods for channel
func (c *Channel) Send(msg Message) {
// Lock write
c.mu.Lock()
defer c.mu.Unlock()
c.Messages = append(c.Messages, msg)
c.TotalMessages++
}