user

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader interface {
	GetById(ctx context.Context, id uint) (*User, error)
	GetByEmail(ctx context.Context, email string) (*User, error)
}

type Repository

type Repository interface {
	Reader
	Writer
}

type User

type User struct {
	ID             uint
	Name           string `json:"name"`
	Email          string `json:"email"`
	Password       string `json:"password"`
	HashedPassword string `json:"hashed_password"`
}

func (*User) HashPassword

func (e *User) HashPassword() error

HashPassword Hashes the given password and store in it

func (*User) VerifyPassword

func (e *User) VerifyPassword() error

VerifyPassword compares the given password with the user's PasswordHash and checks if they match.

type Writer

type Writer interface {
	Create(ctx context.Context, user *User) error
}

Jump to

Keyboard shortcuts

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