repository

package
v0.0.0-...-5b5257d Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MailRepositoryPostgres

type MailRepositoryPostgres struct {
	DB *sql.DB
}

MailRepositoryPostgres represents a PostgreSQL implementation of the MailRepository interface.

func NewMailRepositoryPostgres

func NewMailRepositoryPostgres(db *sql.DB) *MailRepositoryPostgres

NewMailRepositoryPostgres creates a new MailRepositoryPostgres instance.

Parameters:

  • db: A pointer to a *sql.DB representing the PostgreSQL database connection.

Returns:

  • A pointer to the newly created MailRepositoryPostgres instance.

func (*MailRepositoryPostgres) Create

func (r *MailRepositoryPostgres) Create(mail *models.Mail) error

Create inserts a new mail into the PostgreSQL database.

Parameters:

  • mail: A pointer to a Mail struct representing the mail to be inserted.

Returns:

  • An error if the operation fails.

func (*MailRepositoryPostgres) GetMail

func (r *MailRepositoryPostgres) GetMail(mailID string) (*models.Mail, error)

func (*MailRepositoryPostgres) Mailbox

func (r *MailRepositoryPostgres) Mailbox(user, mailboxName string) ([]*models.Mail, error)

type UserRepositoryPostgres

type UserRepositoryPostgres struct {
	DB *sql.DB
}

UserRepositoryPostgres represents a PostgreSQL implementation of the UserRepository interface.

func NewUserRepositoryPostgres

func NewUserRepositoryPostgres(db *sql.DB) *UserRepositoryPostgres

NewUserRepositoryPostgres creates a new UserRepositoryPostgres instance.

func (*UserRepositoryPostgres) Create

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

Create inserts a new user into the PostgreSQL database.

func (*UserRepositoryPostgres) GetAllUsers

func (r *UserRepositoryPostgres) GetAllUsers() ([]*models.User, error)

GetAllUsers retrieves all users from the database.

Jump to

Keyboard shortcuts

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