users

package
v0.0.0-...-4877560 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserData

type UserData struct {
	ID           primitive.ObjectID `json:"id,omitempty" bson:"_id,omitempty"`
	Username     string             `json:"username,omitempty" bson:"username,omitempty"`
	EmailAddress string             `json:"emailAddress,omitempty" bson:"email_address,omitempty"`
	Password     []byte             `json:"password,omitempty" bson:"password,omitempty"`
	CreatedAt    time.Time          `json:"createdAt,omitempty" bson:"created_at,omitempty"`
}

UserData is used only to push data to db

type UserRepository

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

func NewRepository

func NewRepository(logger *zerolog.Logger, collection *mongo.Collection) *UserRepository

func (*UserRepository) CreateUser

func (r *UserRepository) CreateUser(
	ctx context.Context,
	username,
	emailAddress string,
	passwordHash []byte) (*entities.User, error)

CreateUser inserts newly registered user into storage

func (*UserRepository) GetUserByID

func (r *UserRepository) GetUserByID(
	ctx context.Context,
	id string) (*entities.User, error)

GetUserByID retrieves user info from storage

Jump to

Keyboard shortcuts

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