repo

package
v0.0.0-...-2e936b0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

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

Memory represents in-memory storage for users data.

func NewMemory

func NewMemory() *Memory

func (*Memory) Add

func (r *Memory) Add(_ context.Context, user *user.User) error

Add Creates user in the app storage and return ID of new user.

func (*Memory) GetByID

func (r *Memory) GetByID(_ context.Context, userID uuid.UUID) (*user.User, error)

GetByID Finds user by user ID in the app storage.

func (*Memory) GetByUsername

func (r *Memory) GetByUsername(_ context.Context, username string) (*user.User, error)

GetByUsername Finds user by username in the app storage.

type Postgres

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

Postgres represents postgres storage for users data.

func NewPostgres

func NewPostgres(db *sqlx.DB, log *logger.Logger) *Postgres

func (*Postgres) Add

func (r *Postgres) Add(ctx context.Context, usr user.User) error

Add creates user in the app storage and return ID of new user.

func (*Postgres) Count

func (r *Postgres) Count(ctx context.Context) (int, error)

Count returns total numver of users in the DB.

func (*Postgres) GetAll

func (r *Postgres) GetAll(ctx context.Context) ([]user.User, error)

GetAll returns a list of users.

func (*Postgres) GetByID

func (r *Postgres) GetByID(ctx context.Context, userID uuid.UUID) (user.User, error)

GetByID finds user by user ID in the app storage.

func (*Postgres) GetByIDs

func (r *Postgres) GetByIDs(ctx context.Context, userIDs []uuid.UUID) ([]user.User, error)

GetByIDs finds users by user IDs in the app storage.

func (*Postgres) GetByUsername

func (r *Postgres) GetByUsername(ctx context.Context, username string) (user.User, error)

GetByUsername finds user by username in the app storage.

Jump to

Keyboard shortcuts

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