storage

package
v0.0.0-...-a36a601 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRepo

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

func NewChatRepo

func NewChatRepo(db *gorm.DB) *ChatRepo

func (*ChatRepo) Create

func (r *ChatRepo) Create(chat *models.Chat) error

func (*ChatRepo) Delete

func (r *ChatRepo) Delete(chat *models.Chat) error

func (*ChatRepo) FindByID

func (r *ChatRepo) FindByID(id int) (*models.Chat, error)

func (*ChatRepo) FindByUserID

func (r *ChatRepo) FindByUserID(id int) (*[]models.Chat, error)

func (*ChatRepo) FindPrivateChatByUsersArray

func (r *ChatRepo) FindPrivateChatByUsersArray(users []*models.User) (*models.Chat, error)

func (*ChatRepo) Update

func (r *ChatRepo) Update(chat *models.Chat) error

type MessageRepo

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

func NewMessageRepo

func NewMessageRepo(db *gorm.DB) *MessageRepo

func (*MessageRepo) Create

func (r *MessageRepo) Create(message *models.Message) error

func (*MessageRepo) FindAll

func (r *MessageRepo) FindAll() (*[]models.Message, error)

func (*MessageRepo) FindByID

func (r *MessageRepo) FindByID(id int) (*models.Message, error)

func (*MessageRepo) GetMessages

func (r *MessageRepo) GetMessages(chatID, from, limit int) (*[]models.Message, error)

func (*MessageRepo) Update

func (r *MessageRepo) Update(message *models.Message) error

type UserRepo

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

func NewUserRepo

func NewUserRepo(db *gorm.DB, cache *redis.Client) *UserRepo

func (*UserRepo) Create

func (r *UserRepo) Create(user *models.User) error

func (*UserRepo) Delete

func (r *UserRepo) Delete(user *models.User) error

func (*UserRepo) FindAll

func (r *UserRepo) FindAll() (*[]models.User, error)

func (*UserRepo) FindArrayByPartUsername

func (r *UserRepo) FindArrayByPartUsername(username string, order string, limit int) (*[]models.User, error)

func (*UserRepo) FindByID

func (r *UserRepo) FindByID(id int) (*models.User, error)

func (*UserRepo) FindByUsername

func (r *UserRepo) FindByUsername(username string) (*models.User, error)

func (*UserRepo) PasswordMatches

func (r *UserRepo) PasswordMatches(user *models.User, plainText string) (bool, error)

PasswordMatches uses Go's bcrypt package to compare a user supplied password with the hash we have stored for a given user in the database. If the password and hash match, we return true; otherwise, we return false.

func (*UserRepo) ReplaceBlockedUsers

func (r *UserRepo) ReplaceBlockedUsers(user *models.User, blockedUsers []*models.User) error

func (*UserRepo) ReplaceFollowedUsers

func (r *UserRepo) ReplaceFollowedUsers(user *models.User, followedUsers []*models.User) error

func (*UserRepo) ResetPassword

func (r *UserRepo) ResetPassword(user *models.User, password string) error

ResetPassword is the method we will use to change a user's password.

func (*UserRepo) Update

func (r *UserRepo) Update(user *models.User) error

func (*UserRepo) UpdateWithAssociations

func (r *UserRepo) UpdateWithAssociations(user *models.User) error

Jump to

Keyboard shortcuts

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