mongo

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

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRepository

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

func NewMessagesRepository

func NewMessagesRepository(
	db *mongo.Database,
	msg_collection string,
	u_collection string,
) *ChatRepository

func (ChatRepository) CreateMsg

func (c ChatRepository) CreateMsg(ctx context.Context, m *models.Messages) error

CreateMsg creates a new message in MongoDB.

func (ChatRepository) GetMsg

func (r ChatRepository) GetMsg(
	ctx context.Context,
	sender string,
	sender_ip string,
	recipient string,
) (*models.Messages, error)

func (ChatRepository) SetUserOnlineStatus

func (r ChatRepository) SetUserOnlineStatus(ctx context.Context, uID string, isOnline bool) error

type Messages

type Messages struct {
	ID        primitive.ObjectID `bson:"_id,omitempty"`
	Sender    string             `bson:"sender"`
	Recipient string             `bson:"recipient"`
	Content   string             `bson:"content"`
	ServerIP  string             `bson:"server_ip"`
	SenderIP  string             `bson:"sender_ip"`
	IsRead    bool               `bson:"is_read"`
	CreatedAt time.Time          `bson:"created_at"`
	UpdatedAt time.Time          `bson:"updated_at"`
}

Jump to

Keyboard shortcuts

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