repositories

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatParticipantsRepository

type ChatParticipantsRepository interface {
	AddUserToChat(ctx context.Context, chatID, userID string) error
	RemoveUserFromChat(ctx context.Context, chatID, userID string) error
}

type ChatRepository

type ChatRepository interface {
	Create(ctx context.Context, chat *models.Chat) error
	GetByID(ctx context.Context, id string) (*models.Chat, error)
	// offset = 0 & limit = -1 for ignore pagination
	GetAll(ctx context.Context, offset, limit int) ([]models.Chat, error)
	// offset = 0 & limit = -1 for ignore pagination
	GetByUser(ctx context.Context, userID string, offset, limit int) ([]models.Chat, error)
	Update(ctx context.Context, chat *models.Chat) error
	UpdateName(ctx context.Context, id string, name string) error
	DeleteByID(ctx context.Context, id string) error
}

type MessageRepository

type MessageRepository interface {
	Create(ctx context.Context, message *models.Message) error
	GetByID(ctx context.Context, id string) (*models.Message, error)
	GetLastInChat(ctx context.Context, chatID string) (*models.Message, error)
	// offset = 0 & limit = -1 for ignore pagination
	GetAll(ctx context.Context, offset, limit int) ([]models.Message, error)
	// offset = 0 & limit = -1 for ignore pagination
	//
	// order = ASC (for right) or DESC (for reverse) by timestamp
	GetByChat(ctx context.Context, chatID string, offset, limit int, order string) ([]models.Message, error)
	// offset = 0 & limit = -1 for ignore pagination
	//
	// order = ASC (for right) or DESC (for reverse) by timestamp
	GetFromID(ctx context.Context, chatID string, startFrom string, limit int, order string) ([]models.Message, error)
	Update(ctx context.Context, message *models.Message) error
	DeleteByID(ctx context.Context, id string) error
	DeleteByChat(ctx context.Context, chatID string) error
}

type TokenRepository

type TokenRepository interface {
	Create(ctx context.Context, token *models.Token) error
	GetToken(ctx context.Context, tokenString string) (*models.Token, error)
	DeleteToken(ctx context.Context, tokenString string) error
	DeleteExpiredTokens(ctx context.Context) error
	DeleteTokensByUser(ctx context.Context, userID string) error
}

type UserRepository

type UserRepository interface {
	Create(ctx context.Context, user *models.User) error
	GetByID(ctx context.Context, id string) (*models.User, error)
	GetByUsername(ctx context.Context, username string) (*models.User, error)
	GetAll(ctx context.Context) ([]models.User, error)
	Update(ctx context.Context, user *models.User) error
	UpdateStatus(ctx context.Context, id string, status string) error
	DeleteByID(ctx context.Context, id string) error
}

Jump to

Keyboard shortcuts

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