message

package
v0.0.0-...-8de5691 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeTextMessage  = "text"
	TypeImageMessage = "image"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageMessage

type ImageMessage struct {
	ImageURL string
	Caption  string
}

type Message

type Message struct {
	MessageID primitive.ObjectID `bson:"message_id" json:"messageId"`
	SenderID  primitive.ObjectID `bson:"sender_id"  json:"senderId"`
	CreatedAt time.Time          `bson:"created_at" json:"createdAt"`
	Edited    bool               `bson:"edited" json:"edited"`
	Seen      bool               `bson:"seen" json:"seen"`

	// MessageType
	Type    string
	Content interface{}
}

func NewMessage

func NewMessage(senderID primitive.ObjectID, messageType string, content interface{}) *Message

type Repository

type Repository interface {
	Insert(chatID primitive.ObjectID, msg *Message) (*Message, error)
	Update(chatID primitive.ObjectID, messageID primitive.ObjectID, fieldsToUpdate bson.M) error
	Delete(chatID primitive.ObjectID, messageID primitive.ObjectID) error
}

type Service

type Service interface {
	InsertTextMessage(chatID primitive.ObjectID, staticID primitive.ObjectID, messageContent string) (*Message, error)
	DeleteMessage(chatID primitive.ObjectID, messageID primitive.ObjectID) error
}

type TextMessage

type TextMessage struct {
	Message string
}

Jump to

Keyboard shortcuts

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