Files
mtusi2026lab4/internal/messenger/messenger_interface.go
T

45 lines
1.6 KiB
Go

package messenger
import (
"context"
"io"
"time"
"gitea.privcloud.tech/dizi/mtusi2026lab4/internal/model"
)
type MessengerStore interface {
Ping(context.Context) error
CreateUser(context.Context, string, string, string) (model.User, error)
UserByID(context.Context, string) (model.User, error)
UserByUsername(context.Context, string) (model.UserCredentials, error)
CreateChat(context.Context, string, []string, string) (model.Chat, error)
ChatForUser(context.Context, string, string) (model.Chat, error)
ListChats(context.Context, string, *model.Position, int) ([]model.Chat, bool, error)
CreateMessage(context.Context, string, string, string, []string, string, time.Duration) (model.Message, bool, error)
ListMessages(context.Context, string, string, *model.Position, int) ([]model.Message, bool, error)
CreateAttachment(context.Context, model.Attachment) (model.Attachment, error)
AttachmentByStorage(context.Context, string, string) (model.Attachment, error)
AttachmentForUser(context.Context, string, string) (model.Attachment, error)
}
type ObjectStore interface {
Ping(context.Context) error
Put(context.Context, string, string, []byte) error
Get(context.Context, string) (io.ReadCloser, error)
Delete(context.Context, string) error
}
type SessionStore interface {
Ping(context.Context) error
Create(context.Context, string, time.Duration) (string, time.Time, error)
UserID(context.Context, string) (string, error)
Delete(context.Context, string) error
}
type PasswordService interface {
Hash(string) (string, error)
Verify(string, string) (bool, error)
DummyHash() string
}