user

package
v0.0.0-...-1f9e35f Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package user provides user storage functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserRepository

type UserRepository struct {
	Storage UserStorage
}

UserRepository implements the usecases' repository.

All storages in this repo also implement the usecases' repository, so the UserRepository struct might seem obsolete. However it has been implemented to show the hardcore Clean Architecture filosophy.

In more complex applications the UserRepository layer has a clear added value. For example it could use multiple storages, like a cache and persistent database.

func (UserRepository) Create

func (r UserRepository) Create(ctx context.Context, u user.User) error

func (UserRepository) Delete

func (r UserRepository) Delete(ctx context.Context, id string) error

func (UserRepository) Query

func (r UserRepository) Query(ctx context.Context, pageNumber int, rowsPerPage int) ([]user.User, error)

func (UserRepository) QueryByEmail

func (r UserRepository) QueryByEmail(ctx context.Context, email string) (user.User, error)

func (UserRepository) QueryByID

func (r UserRepository) QueryByID(ctx context.Context, id string) (user.User, error)

func (UserRepository) Update

func (r UserRepository) Update(ctx context.Context, u user.User) error

type UserStorage

type UserStorage interface {
	Create(context.Context, user.User) error
	Query(context.Context, int, int) ([]user.User, error)
	QueryByID(context.Context, string) (user.User, error)
	QueryByEmail(context.Context, string) (user.User, error)
	Update(context.Context, user.User) error
	Delete(context.Context, string) error
}

UserStorage is an interface to be implemented by user storages.

Directories

Path Synopsis
Package mem provides memory storage functionality for users.
Package mem provides memory storage functionality for users.
Package pg provides memory storage functionality for users.
Package pg provides memory storage functionality for users.

Jump to

Keyboard shortcuts

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