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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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