mysql

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternal = errors.New("internal server error")
)

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Add(ctx context.Context, user *entity.USER) error
	GetAll(ctx context.Context) ([]entity.USER, error)
	GetOne(ctx context.Context, email string) (*entity.USER, error)
	Delete(ctx context.Context, email string) error
}

Interface defines the contract for user repository operations.

type UserRepository

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

UserRepository implements the Interface for PostgreSQL operations.

func NewUserRepository

func NewUserRepository(db *sql.DB) *UserRepository

NewOfficerRepository creates a new UserRepository instance. It takes a PostgreSQL database connection as a parameter.

func (*UserRepository) Add

func (o *UserRepository) Add(ctx context.Context, user *entity.USER) error

Add inserts a new user into the PostgreSQL database.

func (*UserRepository) Delete

func (o *UserRepository) Delete(ctx context.Context, email string) error

Delete removes a user from the PostgreSQL database based on the provided email.

func (*UserRepository) GetAll

func (o *UserRepository) GetAll(ctx context.Context) ([]entity.USER, error)

GetAll retrieves all users from the PostgreSQL database.

func (*UserRepository) GetOne

func (o *UserRepository) GetOne(ctx context.Context, email string) (*entity.USER, error)

GetOne retrieves a single user from the PostgreSQL database based on the provided email.

Jump to

Keyboard shortcuts

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