psql

package
v0.0.0-...-d5dcd45 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package psql represents a repository for PostgreSQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProfileRepository

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

ProfileRepository is a profile repository.

func NewProfileRepository

func NewProfileRepository(db *postgres.Postgres) ProfileRepository

NewProfileRepository creates a new ProfileRepository.

func (ProfileRepository) CheckFollowing

func (pr ProfileRepository) CheckFollowing(ctx context.Context, followeeID, followerID uuid.UUID) error

CheckFollowing checks if user is following another user.

func (ProfileRepository) Follow

func (pr ProfileRepository) Follow(ctx context.Context, followeeID, followerID uuid.UUID) error

Follow adds follow relationship.

func (ProfileRepository) GetByEmail

func (pr ProfileRepository) GetByEmail(ctx context.Context, email string) (profile.Profile, error)

GetByEmail returns profile by username.

func (ProfileRepository) GetByUsername

func (pr ProfileRepository) GetByUsername(ctx context.Context, username string) (profile.Profile, error)

GetByUsername returns profile by username.

func (ProfileRepository) Unfollow

func (pr ProfileRepository) Unfollow(ctx context.Context, followeeID, followerID uuid.UUID) error

Unfollow removes follow relationship.

type Repositories

type Repositories struct {
	User    UserRepository
	Profile ProfileRepository
}

Repositories is a collection of all repositories in the system.

func NewRepositories

func NewRepositories(db *postgres.Postgres) Repositories

NewRepositories returns a new instance of Repositories.

type UserRepository

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

UserRepository is a user repository.

func NewUserRepository

func NewUserRepository(db *postgres.Postgres) UserRepository

NewUserRepository creates a new UserRepository.

func (UserRepository) Create

func (ur UserRepository) Create(ctx context.Context, dto user.User) (user.User, error)

Create creates a new user.

func (UserRepository) GetByEmail

func (ur UserRepository) GetByEmail(ctx context.Context, email string) (user.User, error)

GetByEmail returns user by email.

func (UserRepository) UpdateByEmail

func (ur UserRepository) UpdateByEmail(ctx context.Context, email string, dto user.UpdateDTO) (user.User, error)

UpdateByEmail updates user by email.

Directories

Path Synopsis
Package mock_psql is a generated GoMock package.
Package mock_psql is a generated GoMock package.

Jump to

Keyboard shortcuts

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