user

package
v0.0.0-...-f6c6508 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(plainPassword string) (string, error)

Hashes a plain text password using Argon2ID

func NewManager

func NewManager(r repository) *manager

func Verify

func Verify(plainPassword, hash string) (bool, error)

Verifies if a plain text password and a hash matches using Argon2ID

Types

type ID

type ID uint64

type InMemoryRepo

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

func NewInMemRepository

func NewInMemRepository() *InMemoryRepo

func (*InMemoryRepo) Create

func (r *InMemoryRepo) Create(user *User) (ID, error)

func (*InMemoryRepo) Delete

func (r *InMemoryRepo) Delete(id ID) error

func (*InMemoryRepo) Get

func (r *InMemoryRepo) Get(id ID) (*User, error)

func (*InMemoryRepo) List

func (r *InMemoryRepo) List() ([]*User, error)

func (*InMemoryRepo) Search

func (r *InMemoryRepo) Search(query string) ([]*User, error)

func (*InMemoryRepo) Update

func (r *InMemoryRepo) Update(user *User) error

type Manager

type Manager interface {
	// contains filtered or unexported methods
}

type Reader

type Reader interface {
	Get(id ID) (*User, error)
	Search(query string) ([]*User, error)
	List() ([]*User, error)
}

type User

type User struct {
	ID        ID
	Name      string
	Email     string
	Password  string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Writer

type Writer interface {
	Create(e *User) (ID, error)
	Update(e *User) error
	Delete(id ID) error
}

Jump to

Keyboard shortcuts

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