chat

package
v0.0.0-...-77d2911 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(e *gin.Engine)

Types

type Conversation

type Conversation struct {
	*gorm.Model
	ID     int
	Users  []User `gorm:"many2many:user_conversations;"`
	Events []Event
}

type Event

type Event struct {
	*gorm.Model
	ID string `gorm:"primaryKey;type:uuid;default:uuid_generate_v4()" json:"id"`
	// Sender can be -1 if event is sent by the system
	Sender         int
	SenderName     string
	Type           string
	Payload        EventPayload
	ConversationID int
}

type EventPayload

type EventPayload map[string]string

func (EventPayload) Scan

func (p EventPayload) Scan(src interface{}) error

func (EventPayload) Value

func (p EventPayload) Value() (driver.Value, error)

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

func NewHub

func NewHub() *Hub

func (*Hub) ConnectClient

func (h *Hub) ConnectClient(conn *websocket.Conn)

func (*Hub) StartListening

func (h *Hub) StartListening(userId string, s *sessions.Session)

type PacketPayload

type PacketPayload struct {
	Type string      `json:"type"`
	Data interface{} `json:"data"`
}

func CreatePacketPayload

func CreatePacketPayload(pk packet.Packet) PacketPayload

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(db *gorm.DB) (*Repository, error)

func (*Repository) AddEvent

func (r *Repository) AddEvent(event *Event) error

type User

type User struct {
	*gorm.Model
	ID            int
	Conversations []Conversation `gorm:"many2many:user_conversations;"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL