chat

package
v0.0.0-...-bae6b6e Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatStorage

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

ChatStorage is a storage implementation for chats using PostgreSQL.

func New

func New(db *sqlx.DB) *ChatStorage

New returns a new instance of ChatStorage with the given database connection.

func (*ChatStorage) AddChat

func (r *ChatStorage) AddChat(ctx context.Context, chat entities.Chat) (entities.Chat, error)

AddChat adds a new chat to the database and returns the newly created chat entity.

func (*ChatStorage) DeleteChatByCompanyId

func (r *ChatStorage) DeleteChatByCompanyId(ctx context.Context, id int) error

DeleteChatByCompanyId deletes all chats from the database that belong to the company with the given ID.

func (*ChatStorage) DeleteChatById

func (r *ChatStorage) DeleteChatById(ctx context.Context, id int64) error

DeleteChatById deletes a chat from the database by its ID.

func (*ChatStorage) GetChatsByCompanyId

func (s *ChatStorage) GetChatsByCompanyId(ctx context.Context, id int64) ([]entities.Chat, error)

GetChatsByCompanyId returns a slice of entities.Chat that belong to the company with the given ID.

func (*ChatStorage) GetChatsByCompanyToken

func (s *ChatStorage) GetChatsByCompanyToken(ctx context.Context, t string) ([]entities.Chat, error)

GetChatsByCompanyToken returns a slice of entities.Chat that belong to the company with the given token.

Jump to

Keyboard shortcuts

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